[VIVO-1031] Reduce redundancy in creating grant sparkles
This commit is contained in:
parent
5033174895
commit
814d38e114
1 changed files with 8 additions and 8 deletions
|
@ -232,10 +232,10 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CollaborationData getQueryResult()
|
public CoInvestigationData getQueryResult()
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
CollaborationData data = getCachedData(this.egoURI);
|
CoInvestigationData data = getCachedData(this.egoURI);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
return getQueryResultAndCache();
|
return getQueryResultAndCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
private CollaborationData getCachedData(String egoURI) {
|
private CoInvestigationData getCachedData(String egoURI) {
|
||||||
CollaborationDataCacheEntry entry = collaborationDataCache.get(egoURI);
|
CollaborationDataCacheEntry entry = collaborationDataCache.get(egoURI);
|
||||||
if (entry != null && !entry.hasExpired()) {
|
if (entry != null && !entry.hasExpired()) {
|
||||||
entry.accessTime = new Date().getTime();
|
entry.accessTime = new Date().getTime();
|
||||||
|
@ -254,10 +254,10 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized CollaborationData getQueryResultAndCache()
|
private synchronized CoInvestigationData getQueryResultAndCache()
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
CollaborationData data = getCachedData(this.egoURI);
|
CoInvestigationData data = getCachedData(this.egoURI);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
|
|
||||||
private static class CollaborationDataCacheEntry {
|
private static class CollaborationDataCacheEntry {
|
||||||
String uri;
|
String uri;
|
||||||
CollaborationData data;
|
CoInvestigationData data;
|
||||||
long creationTime;
|
long creationTime;
|
||||||
long accessTime;
|
long accessTime;
|
||||||
|
|
||||||
|
@ -489,8 +489,8 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CollaborationData getData() {
|
public CoInvestigationData getData() {
|
||||||
return new CoInvestigationData(egoNode, nodes, edges);
|
return new CoInvestigationData(egoNode, nodes, edges, grantURLToVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createCoPIEdges(Map<String, Activity> grantURLToVO,
|
private void createCoPIEdges(Map<String, Activity> grantURLToVO,
|
||||||
|
|
Loading…
Add table
Reference in a new issue