Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions api/src/org/labkey/api/admin/ImportOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class ImportOptions
{
private boolean _skipQueryValidation;
private boolean _createSharedDatasets;
private boolean _advancedImportOptions;
private boolean _failForUndefinedVisits;
private boolean _includeSubfolders = true; // default to true, unless explicitly disabled (i.e. advanced import to multiple folders option)
private String _containerId;
Expand Down Expand Up @@ -83,16 +82,6 @@ public void setCreateSharedDatasets(boolean createSharedDatasets)
_createSharedDatasets = createSharedDatasets;
}

public boolean isAdvancedImportOptions()
{
return _advancedImportOptions;
}

public void setAdvancedImportOptions(boolean advancedImportOptions)
{
_advancedImportOptions = advancedImportOptions;
}

public boolean isFailForUndefinedVisits()
{
return _failForUndefinedVisits;
Expand Down
20 changes: 0 additions & 20 deletions core/src/org/labkey/core/admin/AdminController.java
Original file line number Diff line number Diff line change
Expand Up @@ -5215,7 +5215,6 @@ public static class ImportFolderForm
private boolean _createSharedDatasets;
private boolean _validateQueries;
private boolean _failForUndefinedVisits;
private boolean _advancedImportOptions;
private String _sourceTemplateFolder;
private String _sourceTemplateFolderId;
private String _origin;
Expand Down Expand Up @@ -5250,16 +5249,6 @@ public void setValidateQueries(boolean validateQueries)
_validateQueries = validateQueries;
}

public boolean isAdvancedImportOptions()
{
return _advancedImportOptions;
}

public void setAdvancedImportOptions(boolean advancedImportOptions)
{
_advancedImportOptions = advancedImportOptions;
}

public String getSourceTemplateFolder()
{
return _sourceTemplateFolder;
Expand Down Expand Up @@ -5397,17 +5386,8 @@ public boolean handlePost(ImportFolderForm form, BindException errors) throws Ex
options.setSkipQueryValidation(!form.isValidateQueries());
options.setCreateSharedDatasets(form.isCreateSharedDatasets());
options.setFailForUndefinedVisits(form.isFailForUndefinedVisits());
options.setAdvancedImportOptions(form.isAdvancedImportOptions());
options.setActivity(ComplianceService.get().getCurrentActivity(getViewContext()));

// if the option is selected to show the advanced import options, redirect to there
if (form.isAdvancedImportOptions())
{
// archiveFile is the zip of the source template folder located in the current container's unzip dir
_successURL = pipelineUrlProvider.urlStartFolderImport(getContainer(), fiConfig.archiveFile, options, fiConfig.fromTemplateSourceFolder);
return true;
}

// finally, create the study or folder import pipeline job
_successURL = pipelineUrlProvider.urlBegin(container);
PipelineService.get().runFolderImportJob(container, user, url, archiveXml, fiConfig.originalFileName, pipelineRoot, options);
Expand Down
13 changes: 0 additions & 13 deletions core/src/org/labkey/core/admin/importFolder.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
Container project = c.getProject();
String requestOrigin = (request.getParameter("origin") != null) ? request.getParameter("origin") : "here";
boolean canCreateSharedDatasets = false;
boolean isAdvancedImportOptionEnabled = OptionalFeatureService.get().isFeatureEnabled("advancedImportFlag");

String sharedDatasetsHelpText = "By default, datasets will be created in this container. For Dataspace projects, shared " +
"datasets are created at the project level so that they can be used by each of the study folders in the project.";
Expand Down Expand Up @@ -180,18 +179,6 @@
</label>
</td>
</tr>
<%
if (isAdvancedImportOptionEnabled)
{
%>
<tr>
<td style="padding-left: 15px; padding-top: 5px; padding-bottom: 5px;">
<label><input type="checkbox" name="advancedImportOptions" <%=h(form.isAdvancedImportOptions() ? "checked" : "")%> value="true"> Show advanced import options</label>
</td>
</tr>
<%
}
%>
<tr>
<td style="padding-top: 5px;">
<%= button(action + " " + noun).submit(true) %>
Expand Down
138 changes: 21 additions & 117 deletions pipeline/src/org/labkey/pipeline/PipelineController.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.labkey.api.collections.IntHashMap;
import org.labkey.api.compliance.ComplianceService;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerFilter;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.data.SimpleFilter;
import org.labkey.api.data.TableSelector;
Expand Down Expand Up @@ -84,7 +83,6 @@
import org.labkey.api.security.roles.Role;
import org.labkey.api.security.roles.RoleManager;
import org.labkey.api.settings.AdminConsole;
import org.labkey.api.settings.OptionalFeatureService;
import org.labkey.api.trigger.TriggerConfiguration;
import org.labkey.api.util.DateUtil;
import org.labkey.api.util.FileUtil;
Expand Down Expand Up @@ -1202,8 +1200,6 @@ protected ModelAndView getErrorView(Exception e, BindException errors) throws Ex
@RequiresPermission(AdminPermission.class)
public class StartFolderImportAction extends FormViewAction<StartFolderImportForm>
{
private final List<Container> _importContainers = new ArrayList<>();

private String _navTrail = "Import Folder";
private java.nio.file.Path _archiveFile;

Expand All @@ -1223,60 +1219,11 @@ else if (form.getFilePath() == null)
{
_archiveFile = PipelineManager.validateFolderImportFileNioPath(form.getFilePath(), currentPipelineRoot, errors);

if (OptionalFeatureService.get().isFeatureEnabled(PipelineModule.ADVANCED_IMPORT_FLAG))
{
// Be sure that the set of folder to apply the import to match the setting to enable/disable them
if (form.isApplyToMultipleFolders() && (form.getFolderRowIds() == null || form.getFolderRowIds().isEmpty()))
{
errors.reject(ERROR_MSG, "At least one folder must be selected when 'apply to multiple folders' is enabled.");
}
else if (!form.isApplyToMultipleFolders() && form.getFolderRowIds() != null)
{
errors.reject(ERROR_MSG, "Folder RowIds provided when 'apply to multiple folders' not enabled.");
}
}

// Be sure that the user has admin permissions to all selected folders and that all selected folders exist
if (form.getFolderRowIds() != null)
{
for (Integer rowId : form.getFolderRowIds())
{
Container selectedContainer = ContainerManager.getForRowId(rowId);
if (selectedContainer == null)
errors.reject(ERROR_MSG, "Folder does not exist for selected RowId: " + rowId + ".");
else if (!selectedContainer.hasPermission(getUser(), AdminPermission.class))
errors.reject(ERROR_MSG, "You do not have the required permissions for the selected folder: " + selectedContainer.getTitle() + ".");
else
_importContainers.add(selectedContainer);
}
}
else
{
// default to importing the archive to the current container
_importContainers.add(getContainer());
}

// Be sure that each import container has a valid pipeline root
for (Container container : _importContainers)
{
PipeRoot pipelineRoot = PipelineService.get().findPipelineRoot(container);
if (!PipelineService.get().hasValidPipelineRoot(container) || null == pipelineRoot)
{
errors.reject(ERROR_MSG, "Pipeline root not found for selected container: " + container.getTitle() + ".");
}
}

if (OptionalFeatureService.get().isFeatureEnabled(PipelineModule.ADVANCED_IMPORT_FLAG))
// Be sure that import container has a valid pipeline root
PipeRoot pipelineRoot = PipelineService.get().findPipelineRoot(getContainer());
if (!PipelineService.get().hasValidPipelineRoot(getContainer()) || null == pipelineRoot)
{
// Be sure that the provided data types to import match the setting to enable/disable them
if (form.isSpecificImportOptions() && (form.getDataTypes() == null || form.getDataTypes().isEmpty()))
{
errors.reject(ERROR_MSG, "At least one folder data type must be selected when 'select specific objects to import' is enabled.");
}
else if (!form.isSpecificImportOptions() && form.getDataTypes() != null)
{
errors.reject(ERROR_MSG, "Folder data types provided when 'select specific objects to import' not enabled.");
}
errors.reject(ERROR_MSG, "Pipeline root not found for selected container: " + getContainer().getTitle() + ".");
}
}
}
Expand All @@ -1302,32 +1249,23 @@ public boolean handlePost(StartFolderImportForm form, BindException errors) thro

if (Files.exists(_archiveFile))
{
// iterate over the selected containers, or just the current container in the default case, and unzip the archive if necessary
for (Container container : _importContainers)
{
java.nio.file.Path archiveXml = PipelineManager.getArchiveXmlFile(container, _archiveFile, "folder.xml", errors);
if (errors.hasErrors())
return false;

containerArchiveXmlMap.put(container, archiveXml);
}
java.nio.file.Path archiveXml = PipelineManager.getArchiveXmlFile(getContainer(), _archiveFile, "folder.xml", errors);
if (errors.hasErrors())
return false;

// create a new pipeline import job for applying the imported archive to each selected container
for (Container container : _importContainers)
{
ImportOptions options = new ImportOptions(container.getId(), getUser().getUserId());
options.setSkipQueryValidation(!form.isValidateQueries());
options.setCreateSharedDatasets(form.isCreateSharedDatasets());
options.setFailForUndefinedVisits(form.isFailForUndefinedVisits());
options.setDataTypes(form.getDataTypes());
options.setIncludeSubfolders(!form.isApplyToMultipleFolders());

ComplianceService complianceService = ComplianceService.get();
if (null != complianceService)
options.setActivity(complianceService.getCurrentActivity(getViewContext()));

success = success && createImportPipelineJob(container, user, options, containerArchiveXmlMap.get(container));
}
containerArchiveXmlMap.put(getContainer(), archiveXml);

ImportOptions options = new ImportOptions(getContainer().getId(), getUser().getUserId());
options.setSkipQueryValidation(!form.isValidateQueries());
options.setCreateSharedDatasets(form.isCreateSharedDatasets());
options.setFailForUndefinedVisits(form.isFailForUndefinedVisits());
options.setDataTypes(form.getDataTypes());

ComplianceService complianceService = ComplianceService.get();
options.setActivity(complianceService.getCurrentActivity(getViewContext()));

success = createImportPipelineJob(getContainer(), user, options, containerArchiveXmlMap.get(getContainer()));
}

// the original archive file would have been placed in the current container unzip dir, clean that up
Expand All @@ -1353,19 +1291,8 @@ private boolean createImportPipelineJob(Container container, User user, ImportOp
@Override
public URLHelper getSuccessURL(StartFolderImportForm form)
{
// default case, go to the pipeline jobs page for the current container
// otherwise go to the pipeline jobs page for the project and show all subfolders
Container c = getContainer();
if (_importContainers.size() == 1 && _importContainers.get(0).equals(c))
{
return urlProvider(PipelineStatusUrls.class).urlBegin(c);
}
else
{
ActionURL url = urlProvider(PipelineStatusUrls.class).urlBegin(c.getProject());
url.addParameter("StatusFiles.containerFilterName", ContainerFilter.Type.CurrentAndSubfolders.name());
return url;
}
// go to the pipeline jobs page for the current container
return urlProvider(PipelineStatusUrls.class).urlBegin(getContainer());
}

@Override
Expand All @@ -1382,8 +1309,6 @@ public static class StartFolderImportForm
private String _filePath;
private boolean _validateQueries;
private boolean _createSharedDatasets;
private boolean _specificImportOptions;
private boolean _applyToMultipleFolders;
private boolean _isCloudRoot; // Remove as part of Issue #43835
private boolean _failForUndefinedVisits;
private Set<String> _dataTypes;
Expand Down Expand Up @@ -1419,26 +1344,6 @@ public void setCreateSharedDatasets(boolean createSharedDatasets)
_createSharedDatasets = createSharedDatasets;
}

public boolean isSpecificImportOptions()
{
return _specificImportOptions;
}

public void setSpecificImportOptions(boolean specificImportOptions)
{
_specificImportOptions = specificImportOptions;
}

public boolean isApplyToMultipleFolders()
{
return _applyToMultipleFolders;
}

public void setApplyToMultipleFolders(boolean applyToMultipleFolders)
{
_applyToMultipleFolders = applyToMultipleFolders;
}

public boolean isFailForUndefinedVisits()
{
return _failForUndefinedVisits;
Expand Down Expand Up @@ -1749,7 +1654,6 @@ private ActionURL addStartImportParameters(ActionURL url, @NotNull java.nio.file
url.addParameter("createSharedDatasets", options == null || options.isCreateSharedDatasets());
if (options != null)
{
url.addParameter("advancedImportOptions", options.isAdvancedImportOptions());
url.addParameter("fromZip", true);
url.addParameter("fromTemplateSourceFolder", fromTemplateSourceFolder);
}
Expand Down
12 changes: 0 additions & 12 deletions pipeline/src/org/labkey/pipeline/PipelineModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
import org.labkey.api.pipeline.trigger.PipelineTriggerRegistry;
import org.labkey.api.pipeline.trigger.PipelineTriggerType;
import org.labkey.api.security.User;
import org.labkey.api.settings.OptionalFeatureFlag;
import org.labkey.api.settings.OptionalFeatureService;
import org.labkey.api.usageMetrics.UsageMetricsService;
import org.labkey.api.util.ContextListener;
import org.labkey.api.util.PageFlowUtil;
Expand Down Expand Up @@ -105,7 +103,6 @@
public class PipelineModule extends SpringModule implements ContainerManager.ContainerListener
{
private static final Logger _log = LogHelper.getLogger(PipelineModule.class, "Module responsible for managing pipeline jobs and logs");
public static final String ADVANCED_IMPORT_FLAG = "advancedImportFlag";

@Override
public String getName()
Expand Down Expand Up @@ -216,15 +213,6 @@ protected void startupAfterSpringConfig(ModuleContext moduleContext)

AuditLogService.get().registerAuditType(new ProtocolManagementAuditProvider());

OptionalFeatureService.get().addFeatureFlag(
new OptionalFeatureFlag(
ADVANCED_IMPORT_FLAG,
"Restore 'Advanced Import Options' during Folder import",
"This option will be removed in LabKey Server v25.11.",
false, false, OptionalFeatureService.FeatureType.Deprecated
)
);

UsageMetricsService.get().registerUsageMetrics(getName(), () -> {
DbSchema pipelineSchema = PipelineSchema.getInstance().getSchema();
SqlDialect dialect = PipelineSchema.getInstance().getSchema().getSqlDialect();
Expand Down
4 changes: 0 additions & 4 deletions pipeline/src/org/labkey/pipeline/startPipelineImport.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@

Study study = studyService != null ? studyService.getStudy(getContainer()) : null;
TimepointType timepointType = study != null ? study.getTimepointType() : null;
boolean isAdvancedImportOptionEnabled = OptionalFeatureService.get().isFeatureEnabled(PipelineModule.ADVANCED_IMPORT_FLAG);
%>

<labkey:errors/>
Expand Down Expand Up @@ -92,9 +91,6 @@ Ext4.onReady(function()
canCreateSharedDatasets: <%=canCreateSharedDatasets%>,
isCreateSharedDatasets: <%=bean.isCreateSharedDatasets()%>,
isValidateQueries: <%=bean.isValidateQueries()%>,
showAdvancedImportOptions: <%=isAdvancedImportOptionEnabled%>,
isSpecificImportOptions: <%=bean.isSpecificImportOptions()%>,
isApplyToMultipleFolders: <%=bean.isApplyToMultipleFolders()%>,
isFailForUndefinedVisits: <%=bean.isFailForUndefinedVisits()%>,
isCloudRoot: <%=bean.isCloudRoot()%>, // Remove as part of Issue #43835
showFailForUndefinedVisits: <%=(timepointType == null || timepointType == TimepointType.VISIT) && ((study == null) || !study.isFailForUndefinedTimepoints())%>
Expand Down
Loading