Skip to content

Commit 05be6ca

Browse files
committed
Always re-cache lookups after clear
1 parent fdfaab2 commit 05be6ca

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Studies/src/org/labkey/studies/query/LookupSetsTable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@ public UpdateService(SimpleUserSchema.SimpleTable<SchemaType> ti)
3838
@Override
3939
protected void afterInsertUpdate(int count, BatchValidationException errors)
4040
{
41-
LookupSetsManager.get().getCache().clear();
41+
StudiesUserSchema.repopulateCaches(getUserSchema().getUser(), getUserSchema().getContainer());
4242
}
4343

4444
@Override
4545
protected Map<String, Object> deleteRow(User user, Container container, Map<String, Object> oldRowMap) throws QueryUpdateServiceException, SQLException, InvalidKeyException
4646
{
4747
Map<String, Object> row = super.deleteRow(user, container, oldRowMap);
48-
LookupSetsManager.get().getCache().clear();
48+
StudiesUserSchema.repopulateCaches(getUserSchema().getUser(), getUserSchema().getContainer());
4949
return row;
5050
}
5151

5252
@Override
5353
protected int truncateRows(User user, Container container) throws QueryUpdateServiceException, SQLException
5454
{
5555
int i = super.truncateRows(user, container);
56-
LookupSetsManager.get().getCache().clear();
56+
StudiesUserSchema.repopulateCaches(getUserSchema().getUser(), getUserSchema().getContainer());
5757
return i;
5858
}
5959
}

Studies/src/org/labkey/studies/query/StudiesUserSchema.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ private Container getTargetContainer()
7373
return getContainer().isWorkbookOrTab() ? getContainer().getParent() : getContainer();
7474
}
7575

76+
public static void repopulateCaches(User u, Container c)
77+
{
78+
DbSchema schema = StudiesSchema.getInstance().getSchema();
79+
StudiesUserSchema us = new StudiesUserSchema(u, c, schema);
80+
81+
LookupSetsManager.get().getCache().clear();
82+
us.getPropertySetNames();
83+
}
84+
7685
private Map<String, Map<String, Object>> getPropertySetNames()
7786
{
7887
Map<String, Map<String, Object>> nameMap = (Map<String, Map<String, Object>>) LookupSetsManager.get().getCache().get(LookupSetTable.getCacheKey(getTargetContainer()));
@@ -81,6 +90,7 @@ private Map<String, Map<String, Object>> getPropertySetNames()
8190
return nameMap;
8291
}
8392

93+
_log.debug("Populating lookup tables in StudiesUserSchema.getPropertySetNames() for container: " + getTargetContainer().getName());
8494
nameMap = new CaseInsensitiveHashMap<>();
8595

8696
TableSelector ts = new TableSelector(_dbSchema.getTable(TABLE_LOOKUP_SETS), new SimpleFilter(FieldKey.fromString("container"), getTargetContainer().getId()), null);

0 commit comments

Comments
 (0)