diff --git a/ehr/src/org/labkey/ehr/security/EHRSecurityManager.java b/ehr/src/org/labkey/ehr/security/EHRSecurityManager.java index 48fe8c006..62e20f167 100644 --- a/ehr/src/org/labkey/ehr/security/EHRSecurityManager.java +++ b/ehr/src/org/labkey/ehr/security/EHRSecurityManager.java @@ -224,29 +224,25 @@ public Map getQCStateInfo(Container c) if (targetContainer == null) return Collections.emptyMap(); - Study study = StudyService.get().getStudy(targetContainer); - if (study == null) - return Collections.emptyMap(); - - String cacheKey = getCacheKey(study, QCSTATE_CACHE_ID); + String cacheKey = getCacheKey(targetContainer, QCSTATE_CACHE_ID); Map qcStates = (Map) DataEntryManager.get().getCache().get(cacheKey); - if (qcStates != null) + if (qcStates != null && !qcStates.isEmpty()) return qcStates; qcStates = new HashMap<>(); - for (EHRQCState qc : EHRManager.get().getQCStates(study.getContainer())) + for (EHRQCState qc : EHRManager.get().getQCStates(targetContainer)) { qcStates.put(qc.getLabel(), qc); } qcStates = Collections.unmodifiableMap(qcStates); - DataEntryManager.get().getCache().put(getCacheKey(study, QCSTATE_CACHE_ID), qcStates); + DataEntryManager.get().getCache().put(getCacheKey(targetContainer, QCSTATE_CACHE_ID), qcStates); return qcStates; } - private String getCacheKey(Study s, String suffix) + private String getCacheKey(Container c, String suffix) { - return getClass().getName() + "||" + s.getEntityId() + "||" + suffix; + return getClass().getName() + "||" + c.getEntityId() + "||" + suffix; } }