Skip to content

Commit

Permalink
Use WritablePropertyMap (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-adam authored Oct 3, 2024
1 parent a490a6c commit 256a6a0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;
import org.labkey.api.security.User;
import org.labkey.api.security.UserManager;
import org.labkey.api.security.ValidEmail;
Expand Down Expand Up @@ -112,13 +113,13 @@ public static void setLdapSettings(Map<String, String> props, Map<String, String
}
}

PropertyManager.PropertyMap writableProps = PropertyManager.getWritableProperties(PROPERTY_CATEGORY, true);
WritablePropertyMap writableProps = PropertyManager.getWritableProperties(PROPERTY_CATEGORY, true);
writableProps.clear();

writableProps.putAll(props);
writableProps.save();

PropertyManager.PropertyMap encryptedWritableProps = PropertyManager.getEncryptedStore().getWritableProperties(PROPERTY_CATEGORY_ENCRYPTED, true);
WritablePropertyMap encryptedWritableProps = PropertyManager.getEncryptedStore().getWritableProperties(PROPERTY_CATEGORY_ENCRYPTED, true);
encryptedWritableProps.clear();

encryptedWritableProps.putAll(encryptedProps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import htsjdk.tribble.TribbleException;
import htsjdk.variant.vcf.VCFFileReader;
import htsjdk.variant.vcf.VCFHeader;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
Expand Down Expand Up @@ -59,6 +61,7 @@
import org.labkey.api.data.ConvertHelper;
import org.labkey.api.data.DataRegionSelection;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;
import org.labkey.api.data.Results;
import org.labkey.api.data.ResultsImpl;
import org.labkey.api.data.SQLFragment;
Expand Down Expand Up @@ -173,8 +176,6 @@
import org.springframework.web.bind.ServletRequestParameterPropertyValues;
import org.springframework.web.servlet.ModelAndView;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -4971,7 +4972,7 @@ public static class SetSequenceImportDefaultsAction extends MutatingApiAction<Se
public ApiResponse execute(SetSequenceImportDefaultsForm form, BindException errors) throws Exception
{
Container target = getContainer().isWorkbook() ? getContainer().getParent() : getContainer();
PropertyManager.PropertyMap configMap = PropertyManager.getWritableProperties(target, CONFIG_PROPERTY_DOMAIN_IMPORT, true);
WritablePropertyMap configMap = PropertyManager.getWritableProperties(target, CONFIG_PROPERTY_DOMAIN_IMPORT, true);
configMap.put(INPUT_FILE_TREATMENT, form.getInputFileTreatment());

configMap.save();
Expand Down
4 changes: 2 additions & 2 deletions blast/src/org/labkey/blast/BLASTManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;
import org.labkey.api.data.SimpleFilter;
import org.labkey.api.data.Table;
import org.labkey.api.data.TableInfo;
Expand All @@ -45,7 +46,6 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Date;
import java.util.Map;
Expand All @@ -70,7 +70,7 @@ public static BLASTManager get()

public void saveSettings(Map<String, String> props) throws IllegalArgumentException
{
PropertyManager.PropertyMap configMap = PropertyManager.getWritableProperties(BLASTManager.CONFIG_PROPERTY_DOMAIN, true);
WritablePropertyMap configMap = PropertyManager.getWritableProperties(BLASTManager.CONFIG_PROPERTY_DOMAIN, true);

//validate bin dir
String binDir = StringUtils.trimToNull(props.get(BLAST_BIN_DIR));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.labkey.singlecell;

import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
Expand All @@ -37,6 +38,7 @@
import org.labkey.api.data.ContainerType;
import org.labkey.api.data.DbScope;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;
import org.labkey.api.data.SimpleFilter;
import org.labkey.api.data.TableInfo;
import org.labkey.api.data.TableSelector;
Expand Down Expand Up @@ -66,7 +68,6 @@
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;

import jakarta.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -522,7 +523,7 @@ public static class SetTenXImportDefaultsAction extends MutatingApiAction<SetSeq
public ApiResponse execute(SetSequenceImportDefaultsForm form, BindException errors) throws Exception
{
Container target = getContainer().isWorkbook() ? getContainer().getParent() : getContainer();
PropertyManager.PropertyMap configMap = PropertyManager.getWritableProperties(target, CONFIG_PROPERTY_DOMAIN_IMPORT, true);
WritablePropertyMap configMap = PropertyManager.getWritableProperties(target, CONFIG_PROPERTY_DOMAIN_IMPORT, true);
configMap.put(REQUIRE_ASSAY_TYPE, Boolean.valueOf(form.isRequireAssayType()).toString());
configMap.put(COMBINE_HASHING_CITE, Boolean.valueOf(form.isCombineHashingCite()).toString());

Expand Down

0 comments on commit 256a6a0

Please sign in to comment.