From 4b7acd0e887d643f5b2094ad38212ca0e0a3e60f Mon Sep 17 00:00:00 2001 From: Karl Lum Date: Wed, 28 Jun 2023 16:04:46 -0700 Subject: [PATCH] Issue 47818 : export options to containing metadata only (#108) --- .../trialshare/TrialShareController.java | 82 +++++++++++++++---- .../trialshare/TrialShareExportTest.java | 2 +- 2 files changed, 68 insertions(+), 16 deletions(-) diff --git a/src/org/labkey/trialshare/TrialShareController.java b/src/org/labkey/trialshare/TrialShareController.java index bbff71c5..58638335 100644 --- a/src/org/labkey/trialshare/TrialShareController.java +++ b/src/org/labkey/trialshare/TrialShareController.java @@ -106,14 +106,18 @@ public static class TrialShareExportForm private boolean webpartPropertiesAndLayout; private boolean containerSpecificModuleProperties; private boolean roleAssignmentsForUsersAndGroups; - private boolean lists; + private boolean listDesigns; + private boolean listData; private boolean queries; private boolean gridViews; private boolean reportsAndCharts; private boolean externalSchemaDefinitions; private boolean wikisAndTheirAttachments; private boolean notificationSettings; - private boolean sampleTypesAndDataClasses; + private boolean sampleTypeDesigns; + private boolean sampleTypeData; + private boolean dataClassDesigns; + private boolean dataClassData; private boolean inventoryLocationsAndItems; private boolean experimentsAndRuns; @@ -347,14 +351,24 @@ public void setRoleAssignmentsForUsersAndGroups(boolean roleAssignmentsForUsersA this.roleAssignmentsForUsersAndGroups = roleAssignmentsForUsersAndGroups; } - public boolean getLists() + public boolean isListDesigns() { - return lists; + return listDesigns; } - public void setLists(boolean lists) + public void setListDesigns(boolean listDesigns) { - this.lists = lists; + this.listDesigns = listDesigns; + } + + public boolean isListData() + { + return listData; + } + + public void setListData(boolean listData) + { + this.listData = listData; } public boolean getQueries() @@ -417,14 +431,44 @@ public void setNotificationSettings(boolean notificationSettings) this.notificationSettings = notificationSettings; } - public boolean getSampleTypesAndDataClasses() + public boolean getSampleTypeDesigns() + { + return sampleTypeDesigns; + } + + public void setSampleTypeDesigns(boolean sampleTypeDesigns) + { + this.sampleTypeDesigns = sampleTypeDesigns; + } + + public boolean getSampleTypeData() + { + return sampleTypeData; + } + + public void setSampleTypeData(boolean sampleTypeData) + { + this.sampleTypeData = sampleTypeData; + } + + public boolean getDataClassDesigns() + { + return dataClassDesigns; + } + + public void setDataClassDesigns(boolean dataClassDesigns) + { + this.dataClassDesigns = dataClassDesigns; + } + + public boolean getDataClassData() { - return sampleTypesAndDataClasses; + return dataClassData; } - public void setSampleTypesAndDataClasses(boolean sampleTypesAndDataClasses) + public void setDataClassData(boolean dataClassData) { - this.sampleTypesAndDataClasses = sampleTypesAndDataClasses; + this.dataClassData = dataClassData; } public boolean getInventoryLocationsAndItems() @@ -547,10 +591,14 @@ private static Set getDefaultExportDataTypes() FolderDataTypes.reportsAndCharts, FolderDataTypes.externalSchemaDefinitions, FolderDataTypes.etlDefinitions, - FolderDataTypes.lists, + FolderDataTypes.listDesigns, + FolderDataTypes.listData, FolderDataTypes.wikisAndAttachments, FolderDataTypes.notificationSettings, - FolderDataTypes.sampleTypesAndDataClasses, + FolderDataTypes.sampleTypeDesigns, + FolderDataTypes.sampleTypeData, + FolderDataTypes.dataClassDesigns, + FolderDataTypes.dataClassData, FolderDataTypes.inventoryLocationsAndItems, FolderDataTypes.experiments ); @@ -584,14 +632,18 @@ enum FolderDataTypes webpartProperties("Webpart properties and layout", TrialShareExportForm::getWebpartPropertiesAndLayout), moduleProperties("Container specific module properties", TrialShareExportForm::getContainerSpecificModuleProperties), roleAssignments("Role assignments for users and groups", TrialShareExportForm::getRoleAssignmentsForUsersAndGroups), - lists("Lists", TrialShareExportForm::getLists), + listDesigns("List Designs", TrialShareExportForm::isListDesigns), + listData("List Data", TrialShareExportForm::isListData), queries("Queries", TrialShareExportForm::getQueries), gridViews("Grid Views", TrialShareExportForm::getGridViews), reportsAndCharts("Reports and Charts", TrialShareExportForm::getReportsAndCharts), externalSchemaDefinitions("External schema definitions", TrialShareExportForm::getExternalSchemaDefinitions), wikisAndAttachments("Wikis and their attachments", TrialShareExportForm::getWikisAndTheirAttachments), notificationSettings("Notification settings", TrialShareExportForm::getNotificationSettings), - sampleTypesAndDataClasses("Sample Types and Data Classes", TrialShareExportForm::getSampleTypesAndDataClasses), + sampleTypeDesigns("Sample Type Designs", TrialShareExportForm::getSampleTypeDesigns), + sampleTypeData("Sample Type Data", TrialShareExportForm::getSampleTypeData), + dataClassDesigns("Data Class Designs", TrialShareExportForm::getDataClassDesigns), + dataClassData("Data Class Data", TrialShareExportForm::getDataClassData), inventoryLocationsAndItems("Inventory locations and items", TrialShareExportForm::getInventoryLocationsAndItems), experiments("Experiments, Protocols, and Runs", TrialShareExportForm::getExperimentsAndRuns); @@ -667,7 +719,7 @@ public Set getRegisteredDataTypes(boolean onlyDefault) Set dataTypes = new HashSet<>(); Set filteredFolderWriters; if (onlyDefault) - filteredFolderWriters = folderWriters.stream().filter(fw -> fw.selectedByDefault(ExportType.ALL)).collect(Collectors.toSet()); + filteredFolderWriters = folderWriters.stream().filter(fw -> fw.selectedByDefault(ExportType.ALL, false)).collect(Collectors.toSet()); else filteredFolderWriters = new HashSet<>(folderWriters); diff --git a/test/src/org/labkey/test/tests/trialshare/TrialShareExportTest.java b/test/src/org/labkey/test/tests/trialshare/TrialShareExportTest.java index afd0165b..78d189ad 100644 --- a/test/src/org/labkey/test/tests/trialshare/TrialShareExportTest.java +++ b/test/src/org/labkey/test/tests/trialshare/TrialShareExportTest.java @@ -45,7 +45,7 @@ public void testTrialShareExportActionDefault() throws Exception goToModule("FileContent"); _fileBrowserHelper.selectFileBrowserItem("/export/folder.xml"); List fileList = _fileBrowserHelper.getFileList(); - List expectedFiles = Arrays.asList("etls", "inventory", "sample-types", "wikis", "xar", "data_states.xml", "folder.xml", "pages.xml"); + List expectedFiles = Arrays.asList("data-classes", "etls", "inventory", "sample-types", "wikis", "xar", "data_states.xml", "folder.xml", "pages.xml"); assertEquals("Default export should include several folder objects", expectedFiles, fileList); }