Fixing cache
This commit is contained in:
parent
a21b1d9173
commit
a8fb9de301
|
@ -102,6 +102,7 @@ public class ServerContextCache extends ContextCache {
|
||||||
return ElementManagement.isUserAllowedToGetPrivacyMeta();
|
return ElementManagement.isUserAllowedToGetPrivacyMeta();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized List<Context> getContexts() throws ResourceRegistryException {
|
public synchronized List<Context> getContexts() throws ResourceRegistryException {
|
||||||
refreshContextsIfNeeded();
|
refreshContextsIfNeeded();
|
||||||
ServerRequestInfo requestInfo = RequestUtility.getRequestInfo().get();
|
ServerRequestInfo requestInfo = RequestUtility.getRequestInfo().get();
|
||||||
|
@ -115,6 +116,21 @@ public class ServerContextCache extends ContextCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized Context getContextByUUID(UUID uuid) throws ResourceRegistryException {
|
||||||
|
refreshContextsIfNeeded();
|
||||||
|
ServerRequestInfo requestInfo = RequestUtility.getRequestInfo().get();
|
||||||
|
if(requestInfo.getUriInfo()!=null && !requestInfo.includeMeta()){
|
||||||
|
return uuidToContextNoMeta.get(uuid);
|
||||||
|
}
|
||||||
|
if(isUserAllowedToGetPrivacyMeta()) {
|
||||||
|
return uuidToContext.get(uuid);
|
||||||
|
}else {
|
||||||
|
return uuidToContextMetaPrivacy.get(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Metadata getMetadataForPrivacy(ObjectMapper objectMapper, Metadata metadata) {
|
protected Metadata getMetadataForPrivacy(ObjectMapper objectMapper, Metadata metadata) {
|
||||||
ObjectNode objectNode = objectMapper.valueToTree(metadata);
|
ObjectNode objectNode = objectMapper.valueToTree(metadata);
|
||||||
objectNode.replace(Metadata.CREATED_BY_PROPERTY, new TextNode(Metadata.HIDDEN_FOR_PRIVACY_USER));
|
objectNode.replace(Metadata.CREATED_BY_PROPERTY, new TextNode(Metadata.HIDDEN_FOR_PRIVACY_USER));
|
||||||
|
@ -127,6 +143,7 @@ public class ServerContextCache extends ContextCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setContexts(List<Context> contexts) {
|
protected void setContexts(List<Context> contexts) {
|
||||||
this.contexts = new ArrayList<>();
|
this.contexts = new ArrayList<>();
|
||||||
this.contextsNoMeta = new ArrayList<>();
|
this.contextsNoMeta = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue