diff --git a/src/org/labkey/targetedms/TargetedMSController.java b/src/org/labkey/targetedms/TargetedMSController.java index 61c975106..965dea45a 100644 --- a/src/org/labkey/targetedms/TargetedMSController.java +++ b/src/org/labkey/targetedms/TargetedMSController.java @@ -77,6 +77,8 @@ import org.labkey.api.data.DataRegion; import org.labkey.api.data.DbScope; import org.labkey.api.data.PropertyManager; +import org.labkey.api.data.PropertyManager.PropertyMap; +import org.labkey.api.data.PropertyManager.WritablePropertyMap; import org.labkey.api.data.RenderContext; import org.labkey.api.data.SQLFragment; import org.labkey.api.data.SimpleFilter; @@ -751,12 +753,12 @@ public Object execute(LeveyJenningsPlotOptions form, BindException errors) { ApiSimpleResponse response = new ApiSimpleResponse(); - PropertyManager.PropertyMap properties = null; + PropertyMap properties = null; - // only stash and retrieve plot option properties for logged in users + // only stash and retrieve plot option properties for logged-in users if (!getUser().isGuest()) { - properties = PropertyManager.getWritableProperties(getUser(), getContainer(), QCFolderConstants.CATEGORY, true); + WritablePropertyMap writable = PropertyManager.getWritableProperties(getUser(), getContainer(), QCFolderConstants.CATEGORY, true); Map<String, String> valuesToPersist = form.getAsMapOfStrings(); if (!valuesToPersist.isEmpty()) @@ -766,20 +768,21 @@ public Object execute(LeveyJenningsPlotOptions form, BindException errors) valuesToPersist.put("endDate", form.getEndDate()); valuesToPersist.put("selectedAnnotations", form.getSelectedAnnotationsString()); - properties.putAll(valuesToPersist); - properties.save(); + writable.putAll(valuesToPersist); + writable.save(); } else { - if (properties.containsKey("selectedAnnotations") && (ReplicateManager.getReplicateAnnotationNameValues(getContainer()).size() == 0)) + if (writable.containsKey("selectedAnnotations") && (ReplicateManager.getReplicateAnnotationNameValues(getContainer()).isEmpty())) { // If there are no replicate annotations in this folder anymore, remove any saved annotation filters // Issue 35726: No way to clear previously saved replicate annotation values in QC plots if folder no longer contains annotations - properties.remove("selectedAnnotations"); - properties.save(); + writable.remove("selectedAnnotations"); + writable.save(); } } + properties = writable; } if (properties == null || properties.isEmpty()) @@ -802,8 +805,8 @@ public static class SaveQCPlotSettingsAsDefaultAction extends MutatingApiAction< @Override public Object execute(LeveyJenningsPlotOptions form, BindException errors) { - PropertyManager.PropertyMap current = PropertyManager.getProperties(getUser(), getContainer(), QCFolderConstants.CATEGORY); - PropertyManager.PropertyMap defaults = PropertyManager.getWritableProperties(getContainer(), QCFolderConstants.CATEGORY, true); + PropertyMap current = PropertyManager.getProperties(getUser(), getContainer(), QCFolderConstants.CATEGORY); + WritablePropertyMap defaults = PropertyManager.getWritableProperties(getContainer(), QCFolderConstants.CATEGORY, true); defaults.clear(); // Clear the map. There may be properties that are no longer applicable (e.g. selectedAnnotations, startDate, endDate). defaults.putAll(current); defaults.save(); @@ -825,7 +828,7 @@ public static class RevertToDefaultQCPlotSettingsAction extends MutatingApiActio @Override public Object execute(LeveyJenningsPlotOptions form, BindException errors) { - PropertyManager.PropertyMap current = PropertyManager.getWritableProperties(getUser(), getContainer(), QCFolderConstants.CATEGORY, false); + WritablePropertyMap current = PropertyManager.getWritableProperties(getUser(), getContainer(), QCFolderConstants.CATEGORY, false); if (current != null) { current.delete(); @@ -837,7 +840,7 @@ public Object execute(LeveyJenningsPlotOptions form, BindException errors) } } - private static class LeveyJenningsPlotOptions + public static class LeveyJenningsPlotOptions { private String _metric; private String _yAxisScale; @@ -1306,7 +1309,7 @@ public Object execute(QCMetricOutliersForm form, BindException errors) response.put("offlineAnnotationTypeId", ts2.getObject(Integer.class)); } - PropertyManager.PropertyMap properties = PropertyManager.getWritableProperties(getUser(), getContainer(), QCFolderConstants.CATEGORY, false); + WritablePropertyMap properties = PropertyManager.getWritableProperties(getUser(), getContainer(), QCFolderConstants.CATEGORY, false); if (properties != null) { Map<String, Object> toSend = new HashMap<>(properties); @@ -4158,7 +4161,7 @@ public static class PharmacokineticsOptionsAction extends MutatingApiAction<PKOp @Override public Object execute(PKOptions form, BindException errors) { - PropertyManager.PropertyMap properties = PropertyManager.getWritableProperties(getContainer(), getPropMapName(form), true); + WritablePropertyMap properties = PropertyManager.getWritableProperties(getContainer(), getPropMapName(form), true); // only stash option properties for users with editor role (i.e. UpdatePermissions) if (form.getSubgroups() != null && getContainer().hasPermission(getUser(), UpdatePermission.class)) diff --git a/src/org/labkey/targetedms/chromlib/ChromatogramLibraryUtils.java b/src/org/labkey/targetedms/chromlib/ChromatogramLibraryUtils.java index 2f0be57f8..eb5f6e410 100644 --- a/src/org/labkey/targetedms/chromlib/ChromatogramLibraryUtils.java +++ b/src/org/labkey/targetedms/chromlib/ChromatogramLibraryUtils.java @@ -20,6 +20,7 @@ import org.jetbrains.annotations.Nullable; import org.labkey.api.data.Container; import org.labkey.api.data.PropertyManager; +import org.labkey.api.data.PropertyManager.WritablePropertyMap; import org.labkey.api.pipeline.LocalDirectory; import org.labkey.api.pipeline.PipeRoot; import org.labkey.api.pipeline.PipelineService; @@ -119,7 +120,7 @@ else if (run.getCreated().after(new Date(Files.getLastModifiedTime(clibFile).toM public static int incrementLibraryRevision(Container container, User user, LocalDirectory localDirectory) { - PropertyManager.PropertyMap propMap = PropertyManager.getWritableProperties(container, "TargetedMS", true); + WritablePropertyMap propMap = PropertyManager.getWritableProperties(container, "TargetedMS", true); String revisionVal = propMap.get(PROP_CHROM_LIB_REVISION); int newRevision; if(revisionVal == null) diff --git a/src/org/labkey/targetedms/folderImport/PanoramaQCSettings.java b/src/org/labkey/targetedms/folderImport/PanoramaQCSettings.java index 0a7afd409..c5b101c6c 100644 --- a/src/org/labkey/targetedms/folderImport/PanoramaQCSettings.java +++ b/src/org/labkey/targetedms/folderImport/PanoramaQCSettings.java @@ -1,7 +1,6 @@ package org.labkey.targetedms.folderImport; import org.apache.commons.lang3.StringUtils; -import org.apache.jasper.tagplugins.jstl.core.Import; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.labkey.api.admin.FolderImportContext; @@ -12,6 +11,7 @@ import org.labkey.api.data.Container; import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.PropertyManager; +import org.labkey.api.data.PropertyManager.WritablePropertyMap; import org.labkey.api.data.Results; import org.labkey.api.data.SQLFragment; import org.labkey.api.data.SimpleFilter; @@ -253,7 +253,7 @@ public int importSettingsFromFile(FolderImportContext ctx, VirtualFile panoramaQ props.load(is); if (!ctx.getUser().isGuest()) { - PropertyManager.PropertyMap properties = PropertyManager.getWritableProperties(ctx.getUser(), ctx.getContainer(), QCFolderConstants.CATEGORY, true); + WritablePropertyMap properties = PropertyManager.getWritableProperties(ctx.getUser(), ctx.getContainer(), QCFolderConstants.CATEGORY, true); for (Map.Entry<Object, Object> entry : props.entrySet()) { if (entry.getKey() instanceof String && entry.getValue() instanceof String)