diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/exporter/EntitiesFinder.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/exporter/EntitiesFinder.java index f56d676e1f8dd9ca2eeb4fb4b59b61e106d461f6..b0ef245f381d953fa1be9709de04655660d56ac4 100644 --- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/exporter/EntitiesFinder.java +++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/exporter/EntitiesFinder.java @@ -157,7 +157,11 @@ class EntitiesFinder final List<ExperimentPermId> experimentPermIds = permIds.stream().map(ExperimentPermId::new) .collect(Collectors.toList()); final ExperimentFetchOptions fetchOptions = new ExperimentFetchOptions(); - fetchOptions.withProject().withSpace(); + final ProjectFetchOptions projectFetchOptions = fetchOptions.withProject(); + projectFetchOptions.withSpace(); + projectFetchOptions.withRegistrator(); + projectFetchOptions.withModifier(); + fetchOptions.withType().withPropertyAssignments().withPropertyType(); fetchOptions.withProperties(); fetchOptions.withRegistrator(); diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/exporter/ExportExecutor.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/exporter/ExportExecutor.java index 3e558392a82cdf4ca92f8ea67bbc156cc06da4f5..5bedb52808dd46906cd58ce51196e2116164067a 100644 --- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/exporter/ExportExecutor.java +++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/exporter/ExportExecutor.java @@ -46,12 +46,16 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Base64; import java.util.Collection; +import java.util.Comparator; import java.util.Date; import java.util.EnumSet; import java.util.HashSet; @@ -62,6 +66,8 @@ import java.util.Set; import java.util.stream.Collector; import java.util.stream.Collectors; import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; import javax.annotation.PostConstruct; import javax.annotation.Resource; @@ -320,7 +326,7 @@ public class ExportExecutor implements IExportExecutor final TextFormatting textFormatting, final boolean compatibleWithImport, final Set<ExportFormat> exportFormats) throws IOException { - final String fullFileName = String.format("%s.%s%s", EXPORT_FILE_PREFIX, new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS").format(new Date()), + final String zipFileName = String.format("%s.%s%s", EXPORT_FILE_PREFIX, new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS").format(new Date()), ZIP_EXTENSION); final Collection<String> warnings = new ArrayList<>(); @@ -343,7 +349,7 @@ public class ExportExecutor implements IExportExecutor final ISessionWorkspaceProvider sessionWorkspaceProvider = CommonServiceProvider.getSessionWorkspaceProvider(); final File sessionWorkspaceDirectory = sessionWorkspaceProvider.getSessionWorkspace(sessionToken).getCanonicalFile(); final File docDirectory = new File(sessionWorkspaceDirectory, PDF_DIRECTORY); - mkdir(docDirectory); + mkdirs(docDirectory); exportSpacesDoc(sessionToken, exportFields, entitiesVo, exportFormats, docDirectory); exportProjectsDoc(sessionToken, docDirectory, entitiesVo, exportFields, exportFormats); @@ -358,7 +364,15 @@ public class ExportExecutor implements IExportExecutor } } - return new ExportResult(fullFileName, warnings); + final ISessionWorkspaceProvider sessionWorkspaceProvider = CommonServiceProvider.getSessionWorkspaceProvider(); + final String sessionWorkspaceDirectoryPath = sessionWorkspaceProvider.getSessionWorkspace(sessionToken).getCanonicalPath(); + zipDirectory(sessionWorkspaceDirectoryPath, new File(sessionWorkspaceDirectoryPath, zipFileName)); + + deleteDirectory(sessionWorkspaceDirectoryPath + '/' + XLSX_DIRECTORY); + deleteDirectory(sessionWorkspaceDirectoryPath + '/' + PDF_DIRECTORY); + deleteDirectory(sessionWorkspaceDirectoryPath + '/' + DATA_DIRECTORY); + + return new ExportResult(zipFileName, warnings); } private static void exportXlsx(final IApplicationServerApi api, final String sessionToken, final List<ExportablePermId> exportablePermIds, @@ -371,14 +385,14 @@ public class ExportExecutor implements IExportExecutor exportReferredMasterData, exportFields, textFormatting, compatibleWithImport); final File xlsxDirectory = new File(sessionWorkspaceDirectory, XLSX_DIRECTORY); - mkdir(xlsxDirectory); + mkdirs(xlsxDirectory); final File scriptsDirectory = new File(xlsxDirectory, SCRIPTS_DIRECTORY); final Map<String, String> xlsExportScripts = xlsExportResult.getScripts(); if (!xlsExportScripts.isEmpty()) { - mkdir(scriptsDirectory); + mkdirs(scriptsDirectory); for (final Map.Entry<String, String> script : xlsExportScripts.entrySet()) { @@ -478,13 +492,13 @@ public class ExportExecutor implements IExportExecutor final ISessionWorkspaceProvider sessionWorkspaceProvider = CommonServiceProvider.getSessionWorkspaceProvider(); final File sessionWorkspaceDirectory = sessionWorkspaceProvider.getSessionWorkspace(sessionToken).getCanonicalFile(); final File dataDirectory = new File(sessionWorkspaceDirectory, DATA_DIRECTORY); - mkdir(dataDirectory); + mkdirs(dataDirectory); final File metadataFile = new File(dataDirectory, getDataDirectoryName(prefix, spaceCode, projectCode, containerCode, code, dataSetTypeCode, dataSetCode, dataSetName, META_FILE_NAME)); final File dataSubdirectory = metadataFile.getParentFile(); - mkdir(dataSubdirectory); + mkdirs(dataSubdirectory); try (final OutputStream os = new BufferedOutputStream(new FileOutputStream(metadataFile))) { @@ -543,7 +557,7 @@ public class ExportExecutor implements IExportExecutor final String spaceCode = getSpaceCode(entity); final String folderName = spaceCode == null && entity instanceof Sample ? SHARED_SAMPLES_DIRECTORY : spaceCode; final File space = createNextDocFile(docDirectory, folderName, null, null, null, null, null, null, null, null); - mkdir(space); + mkdirs(space); } } } @@ -574,7 +588,7 @@ public class ExportExecutor implements IExportExecutor if (projectCode != null) { final File space = createNextDocFile(docDirectory, getSpaceCode(entity), projectCode, null, null, null, null, null, null, null); - mkdir(space); + mkdirs(space); } } } @@ -602,7 +616,7 @@ public class ExportExecutor implements IExportExecutor final Project project = experiment.getProject(); final File docFile = createNextDocFile(docDirectory, project.getSpace().getCode(), project.getCode(), experiment.getCode(), getEntityName(experiment), null, null, null, null, null); - mkdir(docFile); + mkdirs(docFile); } } @@ -611,7 +625,7 @@ public class ExportExecutor implements IExportExecutor final Experiment experiment = (Experiment) entity; final Project project = experiment.getProject(); - createDocFilesForEntity(sessionToken, docDirectory, exportFields, project, + createDocFilesForEntity(sessionToken, docDirectory, exportFields, experiment, project.getSpace().getCode(), project.getCode(), experiment.getCode(), getEntityName(experiment), null, null, null, null, exportFormats); } @@ -666,7 +680,7 @@ public class ExportExecutor implements IExportExecutor } } - mkdir(docFile); + mkdirs(docFile); } if (entity instanceof Sample) @@ -675,8 +689,11 @@ public class ExportExecutor implements IExportExecutor final Experiment experiment = sample.getExperiment(); final Sample container = sample.getContainer(); + final String spaceCode = getSpaceCode(sample); + final String spaceFolder = spaceCode != null ? spaceCode : SHARED_SAMPLES_DIRECTORY; + createDocFilesForEntity(sessionToken, docDirectory, exportFields, sample, - getSpaceCode(sample), getProjectCode(sample), experiment != null ? experiment.getCode() : null, + spaceFolder, getProjectCode(sample), experiment != null ? experiment.getCode() : null, experiment != null ? getEntityName(experiment) : null, container != null ? container.getCode() : null, sample.getCode(), getEntityName(sample), null, exportFormats); } @@ -714,59 +731,111 @@ public class ExportExecutor implements IExportExecutor { if (entity instanceof Space) { - return ((Space) entity).getCode(); + return getSpaceCode((Space) entity); } else if (entity instanceof Project) { - return ((Project) entity).getSpace().getCode(); + return getSpaceCode((Project) entity); } else if (entity instanceof Experiment) { - return ((Experiment) entity).getProject().getSpace().getCode(); + return getSpaceCode((Experiment) entity); } else if (entity instanceof Sample) { - final Sample sample = (Sample) entity; - final Space space = sample.getSpace(); - if (space != null) + return getSpaceCode((Sample) entity); + } else if (entity instanceof DataSet) + { + return getSpaceCode((DataSet) entity); + } else + { + throw new IllegalArgumentException(); + } + } + + private static String getSpaceCode(final Space entity) + { + return entity.getCode(); + } + + private static String getSpaceCode(final Project entity) + { + return entity.getSpace().getCode(); + } + + private static String getSpaceCode(final Experiment entity) + { + return entity.getProject().getSpace().getCode(); + } + + private static String getSpaceCode(final Sample sample) + { + final Space space = sample.getSpace(); + if (space != null) + { + return sample.getSpace().getCode(); + } else + { + final Experiment experiment = sample.getExperiment(); + final Project project = sample.getProject(); + if (experiment != null) { - return sample.getSpace().getCode(); + return experiment.getProject().getSpace().getCode(); + } else if (project != null) + { + return project.getSpace().getCode(); } else { - final Experiment experiment = sample.getExperiment(); - final Project project = sample.getProject(); - if (experiment != null) - { - return experiment.getProject().getSpace().getCode(); - } else if (project != null) - { - return project.getSpace().getCode(); - } else - { - return null; - } + return null; } - } else - { - throw new IllegalArgumentException(); } } + private static String getSpaceCode(final DataSet dataSet) + { + final Sample sample = dataSet.getSample(); + return sample != null ? getSpaceCode(sample) : getSpaceCode(dataSet.getExperiment()); + } + private static String getProjectCode(final Object entity) { if (entity instanceof Project) { - return ((Project) entity).getCode(); + return getProjectCode((Project) entity); } else if (entity instanceof Experiment) { - return ((Experiment) entity).getProject().getCode(); + return getProjectCode((Experiment) entity); } else if (entity instanceof Sample) { - final Project project = getProjectForSample((Sample) entity); - return project != null ? project.getCode() : null; + return getProjectCode((Sample) entity); + } else if (entity instanceof DataSet) + { + return getProjectCode((DataSet) entity); } else { throw new IllegalArgumentException(); } } + private static String getProjectCode(final Project project) + { + return project.getCode(); + } + + private static String getProjectCode(final Experiment experiment) + { + return experiment.getProject().getCode(); + } + + private static String getProjectCode(final Sample sample) + { + final Project project = getProjectForSample(sample); + return project != null ? project.getCode() : null; + } + + private static String getProjectCode(final DataSet dataSet) + { + final Sample sample = dataSet.getSample(); + return sample != null ? getProjectCode(sample) : getProjectCode(dataSet.getExperiment()); + } + private static Project getProjectForSample(final Sample sample) { final Experiment experiment = sample.getExperiment(); @@ -911,13 +980,13 @@ public class ExportExecutor implements IExportExecutor final boolean isDirectory = dataSetFile.isDirectory(); final File dataDirectory = new File(sessionWorkspaceDirectory, DATA_DIRECTORY); - mkdir(dataDirectory); + mkdirs(dataDirectory); final File dataSetFsEntry = new File(dataDirectory, getDataDirectoryName(prefix, spaceCode, projectCode, containerCode, entityCode, dataSetTypeCode, dataSetCode, dataSetName, filePath) + (isDirectory ? "/" : "")); final File dataSubdirectory = dataSetFsEntry.getParentFile(); - mkdir(dataSubdirectory); + mkdirs(dataSubdirectory); if (!isDirectory) { @@ -930,7 +999,7 @@ public class ExportExecutor implements IExportExecutor } } else { - mkdir(dataSetFsEntry); + mkdirs(dataSetFsEntry); } } @@ -1402,11 +1471,11 @@ public class ExportExecutor implements IExportExecutor * * @param dir the directory to be created. */ - private static void mkdir(final File dir) + private static void mkdirs(final File dir) { if (!dir.isDirectory()) { - final boolean created = dir.mkdir(); + final boolean created = dir.mkdirs(); if (!created) { throw new RuntimeException(String.format("Cannot create directory '%s'.", dir.getPath())); @@ -1414,6 +1483,49 @@ public class ExportExecutor implements IExportExecutor } } + private static void zipDirectory(final String sourceDirectory, final File targetZipFile) throws IOException { + final Path sourceDir = Paths.get(sourceDirectory); + try (final ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(targetZipFile))) + { + try(final Stream<Path> stream = Files.walk(sourceDir)) + { + stream.filter(path -> !path.equals(sourceDir) && !path.toFile().equals(targetZipFile)) + .forEach(path -> + { + final boolean isDirectory = Files.isDirectory(path); + final String entryName = sourceDir.relativize(path).toString(); + final ZipEntry zipEntry = new ZipEntry(entryName + (isDirectory ? "/" : "")); + try + { + zipOutputStream.putNextEntry(zipEntry); + if (!isDirectory) + { + Files.copy(path, zipOutputStream); + } + zipOutputStream.closeEntry(); + } catch (final IOException e) + { + throw new RuntimeException(e); + } + }); + } + } + } + + public static void deleteDirectory(final String directoryPath) throws IOException { + final Path path = Paths.get(directoryPath); + if (Files.exists(path)) + { + try (final Stream<Path> walkStream = Files.walk(path)) + { + walkStream + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } + } + } + private static class EntitiesVo { diff --git a/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/ExportData.java b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/ExportData.java index 9e4ee1301cbd6845cf7c94a62aaf7ef2b0db3375..1b79d3f0eb2f4b37e868c61b2e43a5a4cfa72b9d 100644 --- a/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/ExportData.java +++ b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/ExportData.java @@ -65,489 +65,489 @@ class ExportData static final String RICH_TEXT_WITH_SPREADSHEET_PROPERTY_NAME = "MULTILINE_WITH_SPREADSHEET"; static final Object[][] EXPORT_DATA = { -// // XLS: All fields -// { -// // Non-existing sample -// "empty-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("WrongPermId"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Space: TEST-SPACE -// "export-space-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Project: TEST-PROJECT -// "export-project-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Experiment: EXP-SPACE-TEST -// "export-experiment-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-compatible-with-import-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// true // withImportCompatibility -// }, -// { -// // Sample: /MP -// "export-sample-shared-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-652"))), -// new AllFields(), -// XlsTextFormat.RICH, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -//// { -//// // Sample: /MP:A03 -//// "export-sample-contained-xlsx.zip", -//// EnumSet.of(ExportFormat.XLSX), -//// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-653"))), -//// new AllFields(), -//// XlsTextFormat.RICH, -//// true, // withReferredTypes -//// false // withImportCompatibility -//// }, -// { -// // Data set: "ROOT_CONTAINER" -// "export-data-set-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.DATASET, new DataSetPermId("ROOT_CONTAINER"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample Type: CELL_PLATE -// "export-sample-type-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE_TYPE, new EntityTypePermId("CELL_PLATE", EntityKind.SAMPLE))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// false, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample Type: CELL_PLATE -// "export-sample-type-with-referred-types-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE_TYPE, new EntityTypePermId("CELL_PLATE", EntityKind.SAMPLE))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Experiment Type: SIRNA_HCS -// "export-experiment-type-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.EXPERIMENT_TYPE, new EntityTypePermId("SIRNA_HCS", EntityKind.EXPERIMENT))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// false, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Dataset Type: HCS_IMAGE -// "export-data-set-type-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.DATASET_TYPE, new EntityTypePermId("HCS_IMAGE", EntityKind.DATA_SET))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// false, // withReferredTypes -// false // withImportCompatibility -// }, -// -// // XLS: Selected fields -// { -// // Space: TEST-SPACE -// "export-space-filtered-attributes-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), -// new SelectedFields(List.of(CODE, REGISTRATOR, DESCRIPTION), List.of()), -// XlsTextFormat.PLAIN, -// false, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Project: TEST-PROJECT -// "export-project-filtered-fields-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), -// new SelectedFields( -// List.of(REGISTRATOR, REGISTRATION_DATE, CODE, IDENTIFIER, SPACE, DESCRIPTION), -// List.of()), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Experiment: EXP-SPACE-TEST -// "export-experiment-filtered-fields-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), -// new SelectedFields( -// List.of(CODE, PERM_ID, IDENTIFIER, PROJECT, REGISTRATOR, MODIFIER), -// List.of(new PropertyTypePermId("GENDER"), new PropertyTypePermId("DESCRIPTION"))), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-filtered-fields-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), -// new SelectedFields( -// List.of(CODE, PERM_ID, IDENTIFIER, SPACE, PARENTS, CHILDREN, REGISTRATOR, REGISTRATION_DATE, MODIFIER, MODIFICATION_DATE), -// List.of(new PropertyTypePermId("BACTERIUM"), new PropertyTypePermId("COMMENT"), new PropertyTypePermId("ORGANISM"))), -// XlsTextFormat.PLAIN, -// false, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Data set: "20081105092159188-3", type: "HCS_IMAGE" -// "export-data-set-filtered-fields-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.DATASET, new DataSetPermId("20081105092159188-3"))), -// new SelectedFields( -// List.of(REGISTRATOR, REGISTRATION_DATE, CODE, IDENTIFIER, PARENTS, CHILDREN, STORAGE_CONFIRMATION, PRESENT_IN_ARCHIVE, -// SAMPLE, EXPERIMENT), -// List.of(new PropertyTypePermId("COMMENT"), new PropertyTypePermId("GENDER"))), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample Type: CELL_PLATE -// "export-sample-type-filtered-attributes-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE_TYPE, new EntityTypePermId("CELL_PLATE", EntityKind.SAMPLE))), -// new SelectedFields(List.of(CODE, AUTO_GENERATE_CODES, DESCRIPTION, GENERATED_CODE_PREFIX, UNIQUE_SUBCODES), List.of()), -// XlsTextFormat.PLAIN, -// false, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Experiment Type: SIRNA_HCS -// "export-experiment-type-filtered-attributes-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.EXPERIMENT_TYPE, new EntityTypePermId("SIRNA_HCS", EntityKind.EXPERIMENT))), -// new SelectedFields(List.of(DESCRIPTION, CODE, MODIFICATION_DATE), List.of()), -// XlsTextFormat.PLAIN, -// false, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Dataset Type: HCS_IMAGE -// "export-data-set-type-filtered-attributes-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.DATASET_TYPE, new EntityTypePermId("HCS_IMAGE", EntityKind.DATA_SET))), -// new SelectedFields(List.of(CODE, DISALLOW_DELETION, DESCRIPTION), List.of()), -// XlsTextFormat.PLAIN, -// false, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-plain-text-xlsx.zip", -// EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. -// new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_PROPERTY_NAME))), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, + // XLS: All fields + { + // Non-existing sample + "empty-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("WrongPermId"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Space: TEST-SPACE + "export-space-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Project: TEST-PROJECT + "export-project-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Experiment: EXP-SPACE-TEST + "export-experiment-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-compatible-with-import-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + true // withImportCompatibility + }, + { + // Sample: /MP + "export-sample-shared-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-652"))), + new AllFields(), + XlsTextFormat.RICH, + true, // withReferredTypes + false // withImportCompatibility + }, // { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-rich-text-xlsx.zip", +// // Sample: /MP:A03 +// "export-sample-contained-xlsx.zip", // EnumSet.of(ExportFormat.XLSX), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. -// new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_PROPERTY_NAME))), -// XlsTextFormat.RICH, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// -// // HTML: All fields -// { -// // Space: TEST-SPACE -// "export-space-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), +// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-653"))), // new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Project: TEST-PROJECT -// "export-project-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Experiment: EXP-SPACE-TEST -// "export-experiment-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /MP -// "export-sample-shared-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-652"))), -// new AllFields(), -// XlsTextFormat.RICH, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -//// { -//// // Sample: /MP:A03 -//// "export-sample-contained-html.zip", -//// EnumSet.of(ExportFormat.HTML), -//// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-653"))), -//// new AllFields(), -//// XlsTextFormat.RICH, -//// true, // withReferredTypes -//// false // withImportCompatibility -//// }, -// { -// // Data set: "ROOT_CONTAINER" -// "export-data-set-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.DATASET, new DataSetPermId("ROOT_CONTAINER"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// -// // HTML: Selected fields -// { -// // Space: TEST-SPACE -// "export-space-filtered-fields-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), -// new SelectedFields(List.of(CODE, PERM_ID, MODIFICATION_DATE), List.of()), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Project: TEST-PROJECT -// "export-project-filtered-fields-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), -// new SelectedFields(List.of(PERM_ID, IDENTIFIER, REGISTRATOR, REGISTRATION_DATE), List.of()), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Experiment: EXP-SPACE-TEST -// "export-experiment-filtered-fields-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), -// new SelectedFields(List.of(CODE, PARENTS, CHILDREN, REGISTRATOR, REGISTRATION_DATE), -// List.of(new PropertyTypePermId("DESCRIPTION"))), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-filtered-fields-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), -// new SelectedFields( -// List.of(CODE, PARENTS, CHILDREN, MODIFIER, MODIFICATION_DATE), -// List.of(new PropertyTypePermId("BACTERIUM"), new PropertyTypePermId("COMMENT"), new PropertyTypePermId("ORGANISM"))), -// XlsTextFormat.PLAIN, -// false, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-plain-text-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. -// new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_PROPERTY_NAME))), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-rich-text-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. -// new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_PROPERTY_NAME))), -// XlsTextFormat.RICH, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-with-image-html.zip", -// EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. -// new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_WITH_IMAGE_PROPERTY_NAME))), // XlsTextFormat.RICH, // true, // withReferredTypes // false // withImportCompatibility // }, + { + // Data set: "ROOT_CONTAINER" + "export-data-set-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.DATASET, new DataSetPermId("ROOT_CONTAINER"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample Type: CELL_PLATE + "export-sample-type-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE_TYPE, new EntityTypePermId("CELL_PLATE", EntityKind.SAMPLE))), + new AllFields(), + XlsTextFormat.PLAIN, + false, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample Type: CELL_PLATE + "export-sample-type-with-referred-types-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE_TYPE, new EntityTypePermId("CELL_PLATE", EntityKind.SAMPLE))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Experiment Type: SIRNA_HCS + "export-experiment-type-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.EXPERIMENT_TYPE, new EntityTypePermId("SIRNA_HCS", EntityKind.EXPERIMENT))), + new AllFields(), + XlsTextFormat.PLAIN, + false, // withReferredTypes + false // withImportCompatibility + }, + { + // Dataset Type: HCS_IMAGE + "export-data-set-type-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.DATASET_TYPE, new EntityTypePermId("HCS_IMAGE", EntityKind.DATA_SET))), + new AllFields(), + XlsTextFormat.PLAIN, + false, // withReferredTypes + false // withImportCompatibility + }, + + // XLS: Selected fields + { + // Space: TEST-SPACE + "export-space-filtered-attributes-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), + new SelectedFields(List.of(CODE, REGISTRATOR, DESCRIPTION), List.of()), + XlsTextFormat.PLAIN, + false, // withReferredTypes + false // withImportCompatibility + }, + { + // Project: TEST-PROJECT + "export-project-filtered-fields-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), + new SelectedFields( + List.of(REGISTRATOR, REGISTRATION_DATE, CODE, IDENTIFIER, SPACE, DESCRIPTION), + List.of()), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Experiment: EXP-SPACE-TEST + "export-experiment-filtered-fields-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), + new SelectedFields( + List.of(CODE, PERM_ID, IDENTIFIER, PROJECT, REGISTRATOR, MODIFIER), + List.of(new PropertyTypePermId("GENDER"), new PropertyTypePermId("DESCRIPTION"))), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-filtered-fields-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), + new SelectedFields( + List.of(CODE, PERM_ID, IDENTIFIER, SPACE, PARENTS, CHILDREN, REGISTRATOR, REGISTRATION_DATE, MODIFIER, MODIFICATION_DATE), + List.of(new PropertyTypePermId("BACTERIUM"), new PropertyTypePermId("COMMENT"), new PropertyTypePermId("ORGANISM"))), + XlsTextFormat.PLAIN, + false, // withReferredTypes + false // withImportCompatibility + }, + { + // Data set: "20081105092159188-3", type: "HCS_IMAGE" + "export-data-set-filtered-fields-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.DATASET, new DataSetPermId("20081105092159188-3"))), + new SelectedFields( + List.of(REGISTRATOR, REGISTRATION_DATE, CODE, IDENTIFIER, PARENTS, CHILDREN, STORAGE_CONFIRMATION, PRESENT_IN_ARCHIVE, + SAMPLE, EXPERIMENT), + List.of(new PropertyTypePermId("COMMENT"), new PropertyTypePermId("GENDER"))), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample Type: CELL_PLATE + "export-sample-type-filtered-attributes-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE_TYPE, new EntityTypePermId("CELL_PLATE", EntityKind.SAMPLE))), + new SelectedFields(List.of(CODE, AUTO_GENERATE_CODES, DESCRIPTION, GENERATED_CODE_PREFIX, UNIQUE_SUBCODES), List.of()), + XlsTextFormat.PLAIN, + false, // withReferredTypes + false // withImportCompatibility + }, + { + // Experiment Type: SIRNA_HCS + "export-experiment-type-filtered-attributes-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.EXPERIMENT_TYPE, new EntityTypePermId("SIRNA_HCS", EntityKind.EXPERIMENT))), + new SelectedFields(List.of(DESCRIPTION, CODE, MODIFICATION_DATE), List.of()), + XlsTextFormat.PLAIN, + false, // withReferredTypes + false // withImportCompatibility + }, + { + // Dataset Type: HCS_IMAGE + "export-data-set-type-filtered-attributes-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.DATASET_TYPE, new EntityTypePermId("HCS_IMAGE", EntityKind.DATA_SET))), + new SelectedFields(List.of(CODE, DISALLOW_DELETION, DESCRIPTION), List.of()), + XlsTextFormat.PLAIN, + false, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-plain-text-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. + new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_PROPERTY_NAME))), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-rich-text-xlsx.zip", + EnumSet.of(ExportFormat.XLSX), + List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. + new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_PROPERTY_NAME))), + XlsTextFormat.RICH, + true, // withReferredTypes + false // withImportCompatibility + }, + + // HTML: All fields + { + // Space: TEST-SPACE + "export-space-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Project: TEST-PROJECT + "export-project-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Experiment: EXP-SPACE-TEST + "export-experiment-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /MP + "export-sample-shared-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-652"))), + new AllFields(), + XlsTextFormat.RICH, + true, // withReferredTypes + false // withImportCompatibility + }, // { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-with-spreadsheet-html.zip", +// // Sample: /MP:A03 +// "export-sample-contained-html.zip", // EnumSet.of(ExportFormat.HTML), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. -// new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_WITH_SPREADSHEET_PROPERTY_NAME))), -// XlsTextFormat.RICH, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// -// // PDF: All fields -// { -// // Space: TEST-SPACE -// "export-space-pdf.zip", -// EnumSet.of(ExportFormat.PDF), -// List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Project: TEST-PROJECT -// "export-project-pdf.zip", -// EnumSet.of(ExportFormat.PDF), -// List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Experiment: EXP-SPACE-TEST -// "export-experiment-pdf.zip", -// EnumSet.of(ExportFormat.PDF), -// List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST -// "export-sample-pdf.zip", -// EnumSet.of(ExportFormat.PDF), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /MP -// "export-sample-shared-pdf.zip", -// EnumSet.of(ExportFormat.PDF), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-652"))), +// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-653"))), // new AllFields(), // XlsTextFormat.RICH, // true, // withReferredTypes // false // withImportCompatibility // }, -// { -// // Data set: "ROOT_CONTAINER" -// "export-data-set-pdf.zip", -// EnumSet.of(ExportFormat.PDF), -// List.of(new ExportablePermId(ExportableKind.DATASET, new DataSetPermId("ROOT_CONTAINER"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// -// // Data -// { -// // Sample: /CISD/NEMO/CP-TEST-3 -// "export-sample-data.zip", -// EnumSet.of(ExportFormat.DATA), -// List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200902091225616-1027"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, -// { -// // Sample: /CISD/NEMO/EXP1 -// "export-experiment-data.zip", -// EnumSet.of(ExportFormat.DATA), -// List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new SamplePermId("200811050951882-1028"))), -// new AllFields(), -// XlsTextFormat.PLAIN, -// true, // withReferredTypes -// false // withImportCompatibility -// }, + { + // Data set: "ROOT_CONTAINER" + "export-data-set-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.DATASET, new DataSetPermId("ROOT_CONTAINER"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + + // HTML: Selected fields + { + // Space: TEST-SPACE + "export-space-filtered-fields-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), + new SelectedFields(List.of(CODE, PERM_ID, MODIFICATION_DATE), List.of()), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Project: TEST-PROJECT + "export-project-filtered-fields-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), + new SelectedFields(List.of(PERM_ID, IDENTIFIER, REGISTRATOR, REGISTRATION_DATE), List.of()), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Experiment: EXP-SPACE-TEST + "export-experiment-filtered-fields-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), + new SelectedFields(List.of(CODE, PARENTS, CHILDREN, REGISTRATOR, REGISTRATION_DATE), + List.of(new PropertyTypePermId("DESCRIPTION"))), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-filtered-fields-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), + new SelectedFields( + List.of(CODE, PARENTS, CHILDREN, MODIFIER, MODIFICATION_DATE), + List.of(new PropertyTypePermId("BACTERIUM"), new PropertyTypePermId("COMMENT"), new PropertyTypePermId("ORGANISM"))), + XlsTextFormat.PLAIN, + false, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-plain-text-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. + new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_PROPERTY_NAME))), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-rich-text-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. + new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_PROPERTY_NAME))), + XlsTextFormat.RICH, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-with-image-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. + new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_WITH_IMAGE_PROPERTY_NAME))), + XlsTextFormat.RICH, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-with-spreadsheet-html.zip", + EnumSet.of(ExportFormat.HTML), + List.of(new ExportablePermId(ExportableKind.SAMPLE, null)), // null perm ID indicates that the newly created value in the setup of the test should be used. + new SelectedFields(List.of(IDENTIFIER, CODE), List.of(new PropertyTypePermId(RICH_TEXT_WITH_SPREADSHEET_PROPERTY_NAME))), + XlsTextFormat.RICH, + true, // withReferredTypes + false // withImportCompatibility + }, + + // PDF: All fields + { + // Space: TEST-SPACE + "export-space-pdf.zip", + EnumSet.of(ExportFormat.PDF), + List.of(new ExportablePermId(ExportableKind.SPACE, new SpacePermId("TEST-SPACE"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Project: TEST-PROJECT + "export-project-pdf.zip", + EnumSet.of(ExportFormat.PDF), + List.of(new ExportablePermId(ExportableKind.PROJECT, new ProjectPermId("20120814110011738-105"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Experiment: EXP-SPACE-TEST + "export-experiment-pdf.zip", + EnumSet.of(ExportFormat.PDF), + List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new ExperimentPermId("201206190940555-1032"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /TEST-SPACE/TEST-PROJECT/FV-TEST + "export-sample-pdf.zip", + EnumSet.of(ExportFormat.PDF), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("201206191219327-1054"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /MP + "export-sample-shared-pdf.zip", + EnumSet.of(ExportFormat.PDF), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200811050947161-652"))), + new AllFields(), + XlsTextFormat.RICH, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Data set: "ROOT_CONTAINER" + "export-data-set-pdf.zip", + EnumSet.of(ExportFormat.PDF), + List.of(new ExportablePermId(ExportableKind.DATASET, new DataSetPermId("ROOT_CONTAINER"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + + // Data + { + // Sample: /CISD/NEMO/CP-TEST-3 + "export-sample-data.zip", + EnumSet.of(ExportFormat.DATA), + List.of(new ExportablePermId(ExportableKind.SAMPLE, new SamplePermId("200902091225616-1027"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, + { + // Sample: /CISD/NEMO/EXP1 + "export-experiment-data.zip", + EnumSet.of(ExportFormat.DATA), + List.of(new ExportablePermId(ExportableKind.EXPERIMENT, new SamplePermId("200811050951882-1028"))), + new AllFields(), + XlsTextFormat.PLAIN, + true, // withReferredTypes + false // withImportCompatibility + }, // All { diff --git a/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/test_files/export/export-data-set-html.zip b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/test_files/export/export-data-set-html.zip index c55b23993c96d9d5beaca3fe426bb5adc095b89e..88bb91f7fb876ed6aecfa0d449c1a5dce2842706 100644 Binary files a/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/test_files/export/export-data-set-html.zip and b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/test_files/export/export-data-set-html.zip differ diff --git a/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/test_files/export/export-sample-all.zip b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/test_files/export/export-sample-all.zip new file mode 100644 index 0000000000000000000000000000000000000000..806e0ba0cf6c198c187d90ed24cc114b1a65a4ae Binary files /dev/null and b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/test_files/export/export-sample-all.zip differ