Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use WritablePropertyMap #1146

Merged
merged 1 commit into from
Oct 2, 2024
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
5 changes: 3 additions & 2 deletions GeneticsCore/src/org/labkey/GeneticsCore/mhc/MhcTaskRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.labkey.api.data.CompareType;
import org.labkey.api.data.Container;
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 @@ -97,7 +98,7 @@ public void setContainerUser(ContainerUser containerUser)

public static void saveLastRun(Container container, Date jobStart)
{
PropertyManager.PropertyMap map = PropertyManager.getWritableProperties(container, PROP_CATEGORY, true);
WritablePropertyMap map = PropertyManager.getWritableProperties(container, PROP_CATEGORY, true);
if (jobStart != null)
{
map.put(lastRunTime, String.valueOf(jobStart.getTime()));
Expand All @@ -112,7 +113,7 @@ public static void saveLastRun(Container container, Date jobStart)

private Date getLastRun(Container c)
{
PropertyManager.PropertyMap map = PropertyManager.getWritableProperties(c, PROP_CATEGORY, true);
WritablePropertyMap map = PropertyManager.getWritableProperties(c, PROP_CATEGORY, true);
return map.containsKey(lastRunTime) ? new Date(Long.parseLong(map.get(lastRunTime))) : null;
}

Expand Down
3 changes: 2 additions & 1 deletion mergesync/src/org/labkey/mergesync/MergeSyncController.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.labkey.api.data.ContainerManager;
import org.labkey.api.data.ConvertHelper;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;
import org.labkey.api.security.RequiresPermission;
import org.labkey.api.security.ValidEmail;
import org.labkey.api.security.permissions.AdminPermission;
Expand Down Expand Up @@ -55,7 +56,7 @@ public ApiResponse execute(EtlAdminForm form, BindException errors)
{
Map<String, Object> resultProperties = new HashMap<>();

PropertyManager.PropertyMap configMap = PropertyManager.getWritableProperties(MergeSyncManager.CONFIG_PROPERTY_DOMAIN, true);
WritablePropertyMap configMap = PropertyManager.getWritableProperties(MergeSyncManager.CONFIG_PROPERTY_DOMAIN, true);

configMap.put(MergeSyncManager.DATA_SOURCE_PROP_NAME, form.getDataSourceName());
configMap.put(MergeSyncManager.SCHEMA_PROP_NAME, form.getSchemaName());
Expand Down
5 changes: 3 additions & 2 deletions mergesync/src/org/labkey/mergesync/MergeSyncManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
package org.labkey.mergesync;

import org.apache.commons.lang3.time.DateUtils;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.data.DbSchema;
import org.labkey.api.data.DbSchemaType;
import org.labkey.api.data.DbScope;
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 @@ -212,7 +213,7 @@ public Date getLastRun()

public void setLastRun(Date date)
{
PropertyManager.PropertyMap pm = PropertyManager.getWritableProperties(CONFIG_PROPERTY_DOMAIN, true);
WritablePropertyMap pm = PropertyManager.getWritableProperties(CONFIG_PROPERTY_DOMAIN, true);
date = DateUtils.truncate(date, Calendar.MINUTE); //always round to nearest minute
pm.put(LAST_RUN_PROP_NAME, String.valueOf(date.getTime()));
pm.save();
Expand Down
3 changes: 2 additions & 1 deletion ogasync/src/org/labkey/ogasync/OGASyncController.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.labkey.api.action.SpringActionController;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;
import org.labkey.api.security.RequiresPermission;
import org.labkey.api.security.ValidEmail;
import org.labkey.api.security.permissions.AdminPermission;
Expand Down Expand Up @@ -83,7 +84,7 @@ public ApiResponse execute(EtlAdminForm form, BindException errors)
{
Map<String, Object> resultProperties = new HashMap<>();

PropertyManager.PropertyMap configMap = PropertyManager.getWritableProperties(OGASyncManager.CONFIG_PROPERTY_DOMAIN, true);
WritablePropertyMap configMap = PropertyManager.getWritableProperties(OGASyncManager.CONFIG_PROPERTY_DOMAIN, true);

if (form.getLabkeyUser() != null)
{
Expand Down
3 changes: 2 additions & 1 deletion ogasync/src/org/labkey/ogasync/OGASyncManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.labkey.api.data.DbSchemaType;
import org.labkey.api.data.DbScope;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;
import org.labkey.api.data.TableInfo;
import org.labkey.api.security.User;
import org.labkey.api.security.UserManager;
Expand Down Expand Up @@ -349,7 +350,7 @@ public void validateSettings() throws IllegalArgumentException

public void setLastRun(Date date)
{
PropertyManager.PropertyMap pm = PropertyManager.getWritableProperties(CONFIG_PROPERTY_DOMAIN, true);
WritablePropertyMap pm = PropertyManager.getWritableProperties(CONFIG_PROPERTY_DOMAIN, true);
pm.put(LAST_RUN_PROP_NAME, String.valueOf(date.getTime()));
pm.save();
}
Expand Down
3 changes: 2 additions & 1 deletion onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.labkey.api.data.Container;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;
import org.labkey.api.query.Queryable;
import org.labkey.api.security.User;
import org.labkey.api.settings.LookAndFeelProperties;
Expand Down Expand Up @@ -103,7 +104,7 @@ public static ONPRC_EHRManager get()

public void lockAnimalCreation(Container c, User u, Boolean lock, Integer startingId, Integer idCount)
{
PropertyManager.PropertyMap map = PropertyManager.getWritableProperties(c, LOCK_PROP_KEY, true);
WritablePropertyMap map = PropertyManager.getWritableProperties(c, LOCK_PROP_KEY, true);
map.put("lockedBy", u.getDisplayName(u));
map.put("locked", lock.toString());
map.put("lockDate", new SimpleDateFormat(LookAndFeelProperties.getInstance(c).getDefaultDateTimeFormat()).format(new Date()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,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.issues.Issue;
import org.labkey.api.issues.RestrictedIssueProvider;
import org.labkey.api.query.SimpleValidationError;
Expand Down Expand Up @@ -60,7 +61,7 @@ public void setRestrictedIssueListGroup(Container c, String issueDefName, @Nulla

private void setPropertyValue(Container c, String issueDefName, String key, String value)
{
PropertyManager.PropertyMap props = PropertyManager.getWritableProperties(c, getPropMapName(issueDefName), true);
WritablePropertyMap props = PropertyManager.getWritableProperties(c, getPropMapName(issueDefName), true);
props.put(key, value);
props.save();
}
Expand Down Expand Up @@ -143,8 +144,8 @@ private boolean checkAccess(User user, @NotNull Issue issue, @Nullable Group gro
@Override
public void deleteProperties(Container c, String issueDefName)
{
PropertyManager.PropertyMap properties = PropertyManager.getProperties(c, getPropMapName(issueDefName));
if (!properties.isEmpty())
WritablePropertyMap properties = PropertyManager.getWritableProperties(c, getPropMapName(issueDefName), false);
if (properties != null)
{
properties.delete();
}
Expand Down
7 changes: 4 additions & 3 deletions sla/src/org/labkey/sla/SLAController.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.labkey.api.data.ContainerManager;
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 @@ -164,7 +165,7 @@ public ApiResponse execute(EtlAdminForm form, BindException errors)
{
Map<String, Object> resultProperties = new HashMap<>();

PropertyManager.PropertyMap configMap = PropertyManager.getWritableProperties(ETLRunnable.CONFIG_PROPERTY_DOMAIN, true);
WritablePropertyMap configMap = PropertyManager.getWritableProperties(ETLRunnable.CONFIG_PROPERTY_DOMAIN, true);

boolean shouldReschedule = false;
if (form.getLabkeyUser() != null)
Expand Down Expand Up @@ -193,8 +194,8 @@ public ApiResponse execute(EtlAdminForm form, BindException errors)

configMap.save();

PropertyManager.PropertyMap rowVersionMap = PropertyManager.getWritableProperties(ETLRunnable.ROWVERSION_PROPERTY_DOMAIN, true);
PropertyManager.PropertyMap timestampMap = PropertyManager.getWritableProperties(ETLRunnable.TIMESTAMP_PROPERTY_DOMAIN, true);
WritablePropertyMap rowVersionMap = PropertyManager.getWritableProperties(ETLRunnable.ROWVERSION_PROPERTY_DOMAIN, true);
WritablePropertyMap timestampMap = PropertyManager.getWritableProperties(ETLRunnable.TIMESTAMP_PROPERTY_DOMAIN, true);

if (form.getTimestamps() != null)
{
Expand Down
5 changes: 3 additions & 2 deletions sla/src/org/labkey/sla/etl/ETL.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
*/
package org.labkey.sla.etl;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;

import java.io.IOException;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -164,7 +165,7 @@ public static boolean isRunning()

private static void setEnabled(Boolean enabled)
{
PropertyManager.PropertyMap pm = PropertyManager.getWritableProperties(ETLRunnable.CONFIG_PROPERTY_DOMAIN, true);
WritablePropertyMap pm = PropertyManager.getWritableProperties(ETLRunnable.CONFIG_PROPERTY_DOMAIN, true);
pm.put(ENABLED_PROP_NAME, enabled.toString());
pm.save();
}
Expand Down
5 changes: 3 additions & 2 deletions sla/src/org/labkey/sla/etl/ETLRunnable.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.labkey.api.data.DbSchema;
import org.labkey.api.data.DbScope;
import org.labkey.api.data.PropertyManager;
import org.labkey.api.data.PropertyManager.WritablePropertyMap;
import org.labkey.api.data.SQLFragment;
import org.labkey.api.data.SimpleFilter;
import org.labkey.api.data.SqlExecutor;
Expand Down Expand Up @@ -827,7 +828,7 @@ boolean isEmpty(TableInfo tinfo) throws SQLException
private void setLastTimestamp(String tableName, Long ts)
{
log.info(String.format("setting new baseline timestamp of %s on collection %s", new Date(ts.longValue()).toString(), tableName));
PropertyManager.PropertyMap pm = PropertyManager.getWritableProperties(TIMESTAMP_PROPERTY_DOMAIN, true);
WritablePropertyMap pm = PropertyManager.getWritableProperties(TIMESTAMP_PROPERTY_DOMAIN, true);
pm.put(tableName, ts.toString());
pm.save();
}
Expand Down Expand Up @@ -865,7 +866,7 @@ private Long getOriginDataSourceCurrentTime() throws SQLException, BadConfigExce
*/
private void setLastVersion(String tableName, byte[] version)
{
PropertyManager.PropertyMap pm = PropertyManager.getWritableProperties(ROWVERSION_PROPERTY_DOMAIN, true);
WritablePropertyMap pm = PropertyManager.getWritableProperties(ROWVERSION_PROPERTY_DOMAIN, true);
byte[] encoded = Base64.encodeBase64(version);
try
{
Expand Down