Committing the following changes
1) Handling Null pointer Exceptions for EntityPubCount, EntityGrantCount and EntitySubOrganizationTypes 2) Removing the dependency on vis_mode parameter in the server side code. The class the individual belongs to is retrieved using vitroRequest.getWebappDaoFactory().getIndividualDao().getIndividualByURI(IndividualURI).isVClass(ClassURI) 3) On the client side, the vis_mode parameter is set(from the value passed on by the requesthandler) to differentiate between personURL and SubOrganizationTemporalGraphURL on drill down. 4) Added entityComparisonErrorActivator.ftl to handle edge cases (if the resultset of the queries is NULL)
This commit is contained in:
parent
2152bb6008
commit
9971e5fa2b
9 changed files with 121 additions and 113 deletions
|
@ -105,7 +105,7 @@
|
||||||
<listener>
|
<listener>
|
||||||
<listener-class>edu.cornell.mannlib.vitro.webapp.servlet.setup.PelletReasonerSetup</listener-class>
|
<listener-class>edu.cornell.mannlib.vitro.webapp.servlet.setup.PelletReasonerSetup</listener-class>
|
||||||
</listener>
|
</listener>
|
||||||
<!-- -->
|
|
||||||
|
|
||||||
<!-- The followng listener records all edit changes, in reified form, to another database model -->
|
<!-- The followng listener records all edit changes, in reified form, to another database model -->
|
||||||
<!-- still at an experimental stage -->
|
<!-- still at an experimental stage -->
|
||||||
|
|
|
@ -464,7 +464,7 @@ function getTemporalVisURL(entity) {
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
|
|
||||||
result = subOrganizationTemporalGraphURL+ "&vis_mode=" + entity.visMode + "&" +
|
result = subOrganizationTemporalGraphURL + "&" +
|
||||||
"uri=" + entity.entityURI ;
|
"uri=" + entity.entityURI ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,16 +857,16 @@ function setEntityLevel(){
|
||||||
function getEntityVisMode(jsonData){
|
function getEntityVisMode(jsonData){
|
||||||
|
|
||||||
$.each(jsonData, function(index, val) {
|
$.each(jsonData, function(index, val) {
|
||||||
if (val.visMode == "SCHOOL" || val.visMode == "UNIVERSITY" || val.visMode == "DEPARTMENT"){
|
if (val.visMode == "PERSON"){
|
||||||
entityLevel = "Organizations";
|
|
||||||
} else {
|
|
||||||
entityLevel = "People";
|
entityLevel = "People";
|
||||||
|
} else {
|
||||||
|
entityLevel = "Organizations";
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
/* To provide graceful degradation set entity level to a default error message.*/
|
/* To provide graceful degradation set entity level to a default error message.*/
|
||||||
entityElevel = "ENTITY LEVEL UNDEFINED ERROR";
|
entitylevel = "ENTITY LEVEL UNDEFINED ERROR";
|
||||||
}
|
}
|
||||||
|
|
||||||
function toCamelCase(string){
|
function toCamelCase(string){
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#assign organizationURI ="${organizationURI?url}">
|
||||||
|
<#assign organizationVivoProfileURL = "${urls.base}/individual?uri=${organizationURI}">
|
||||||
|
|
||||||
|
<#-- variables passed from server-side code -->
|
||||||
|
<script language="JavaScript" type="text/javascript">
|
||||||
|
|
||||||
|
var contextPath = "${urls.base}";
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="body">
|
||||||
|
<p>This Organization has neither Sub-Organizations nor People. Please visit this Organization's <a href="${organizationVivoProfileURL}">profile page.</a></p>
|
||||||
|
</div>
|
|
@ -16,7 +16,7 @@
|
||||||
<#assign temporalGraphSmallIcon = '${urls.images}/visualization/temporal_vis_small_icon.jpg'>
|
<#assign temporalGraphSmallIcon = '${urls.images}/visualization/temporal_vis_small_icon.jpg'>
|
||||||
|
|
||||||
|
|
||||||
<#assign TemporalGraphDownloadFile = '${urls.base}${dataVisualizationURLRoot}?vis=entity_comparison&uri=${organizationURI}&labelField=label&vis_mode=UNIVERSITY'>
|
<#assign TemporalGraphDownloadFile = '${urls.base}${dataVisualizationURLRoot}?vis=entity_comparison&uri=${organizationURI}&labelField=label'>
|
||||||
|
|
||||||
|
|
||||||
<#-- Javascript files -->
|
<#-- Javascript files -->
|
||||||
|
|
|
@ -183,11 +183,14 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
|
||||||
entity.addPublications(biboDocument);
|
entity.addPublications(biboDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(subentityURLToVO.size() == 0){
|
if(subentityURLToVO.size() == 0 && personURLToVO.size() != 0){
|
||||||
for(SubEntity person : personURLToVO.values()){
|
for(SubEntity person : personURLToVO.values()){
|
||||||
entity.addSubEntity(person);
|
entity.addSubEntity(person);
|
||||||
}
|
}
|
||||||
|
} else if (subentityURLToVO.size() == 0 && personURLToVO.size() == 0){
|
||||||
|
entity = new Entity(this.entityURI, "no-label");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: return non-null value
|
//TODO: return non-null value
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,6 @@ import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.Visual
|
||||||
public class EntityPublicationCountRequestHandler implements
|
public class EntityPublicationCountRequestHandler implements
|
||||||
VisualizationRequestHandler {
|
VisualizationRequestHandler {
|
||||||
|
|
||||||
public static String ENTITY_VIS_MODE;
|
|
||||||
public static String SUB_ENTITY_VIS_MODE;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseValues generateStandardVisualization(
|
public ResponseValues generateStandardVisualization(
|
||||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||||
|
@ -45,28 +41,31 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
String entityURI = vitroRequest
|
String entityURI = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||||
|
|
||||||
ENTITY_VIS_MODE = vitroRequest
|
|
||||||
.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY);
|
|
||||||
|
|
||||||
QueryRunner<Entity> queryManager = new EntityPublicationCountQueryRunner(
|
QueryRunner<Entity> queryManager = new EntityPublicationCountQueryRunner(
|
||||||
entityURI, dataSource, log);
|
entityURI, dataSource, log);
|
||||||
|
|
||||||
Entity entity = queryManager.getQueryResult();
|
Entity entity = queryManager.getQueryResult();
|
||||||
|
|
||||||
setVisModes();
|
if(entity.getEntityLabel().equals("no-label")){
|
||||||
|
|
||||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
|
||||||
entityURI, dataSource, log);
|
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes
|
|
||||||
.getQueryResult();
|
|
||||||
|
|
||||||
return prepareStandaloneResponse(vitroRequest, entity, entityURI,
|
|
||||||
subOrganizationTypesResult);
|
|
||||||
|
|
||||||
|
return prepareStandaloneErrorResponse(vitroRequest,entityURI);
|
||||||
|
|
||||||
|
} else{
|
||||||
|
|
||||||
|
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||||
|
entityURI, dataSource, log);
|
||||||
|
|
||||||
|
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes
|
||||||
|
.getQueryResult();
|
||||||
|
|
||||||
|
return prepareStandaloneResponse(vitroRequest, entity, entityURI,
|
||||||
|
subOrganizationTypesResult);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> generateDataVisualization(
|
public Map<String, String> generateDataVisualization(
|
||||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||||
|
@ -74,15 +73,12 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
String entityURI = vitroRequest
|
String entityURI = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||||
|
|
||||||
ENTITY_VIS_MODE = vitroRequest
|
|
||||||
.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY);
|
|
||||||
|
|
||||||
QueryRunner<Entity> queryManager = new EntityPublicationCountQueryRunner(
|
QueryRunner<Entity> queryManager = new EntityPublicationCountQueryRunner(
|
||||||
entityURI, dataSource, log);
|
entityURI, dataSource, log);
|
||||||
|
|
||||||
Entity entity = queryManager.getQueryResult();
|
Entity entity = queryManager.getQueryResult();
|
||||||
setVisModes();
|
|
||||||
|
|
||||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||||
entityURI, dataSource, log);
|
entityURI, dataSource, log);
|
||||||
|
@ -148,7 +144,7 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
String standaloneTemplate = "entityComparisonStandaloneActivator.ftl";
|
String standaloneTemplate = "entityComparisonStandaloneActivator.ftl";
|
||||||
|
|
||||||
String jsonContent = "";
|
String jsonContent = "";
|
||||||
jsonContent = writePublicationsOverTimeJSON(entity.getSubEntities(), subOrganizationTypesResult);
|
jsonContent = writePublicationsOverTimeJSON(vreq, entity.getSubEntities(), subOrganizationTypesResult);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,37 +157,32 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
return new TemplateResponseValues(standaloneTemplate, body);
|
return new TemplateResponseValues(standaloneTemplate, body);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void setVisModes() {
|
|
||||||
|
|
||||||
if (ENTITY_VIS_MODE.equalsIgnoreCase("DEPARTMENT")) {
|
|
||||||
SUB_ENTITY_VIS_MODE = "PERSON";
|
|
||||||
}else if (ENTITY_VIS_MODE.equalsIgnoreCase("SCHOOL")) {
|
|
||||||
SUB_ENTITY_VIS_MODE = "DEPARTMENT";
|
|
||||||
}else {
|
|
||||||
SUB_ENTITY_VIS_MODE = "SCHOOL";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ResponseValues prepareStandaloneErrorResponse(
|
||||||
|
VitroRequest vitroRequest, String entityURI) {
|
||||||
|
|
||||||
|
Portal portal = vitroRequest.getPortal();
|
||||||
|
String standaloneTemplate = "entityComparisonErrorActivator.ftl";
|
||||||
|
|
||||||
|
Map<String, Object> body = new HashMap<String, Object>();
|
||||||
|
body.put("portalBean", portal);
|
||||||
|
body.put("title", "Temporal Graph Visualization");
|
||||||
|
body.put("organizationURI", entityURI);
|
||||||
|
|
||||||
|
return new TemplateResponseValues(standaloneTemplate, body);
|
||||||
|
|
||||||
private void setEntityVisMode(JsonObject entityJson) {
|
|
||||||
if(entityJson.getOrganizationType().contains("Department")){
|
|
||||||
entityJson.setVisMode("DEPARTMENT");
|
|
||||||
}else if(entityJson.getOrganizationType().contains("School")){
|
|
||||||
entityJson.setVisMode("SCHOOL");
|
|
||||||
}else{
|
|
||||||
entityJson.setVisMode(SUB_ENTITY_VIS_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to generate a json file for year <-> publication count mapping
|
* function to generate a json file for year <-> publication count mapping
|
||||||
|
* @param vreq
|
||||||
* @param subentities
|
* @param subentities
|
||||||
* @param subOrganizationTypesResult
|
* @param subOrganizationTypesResult
|
||||||
*/
|
*/
|
||||||
private String writePublicationsOverTimeJSON(Set<SubEntity> subentities, Map<String, Set<String>> subOrganizationTypesResult) {
|
private String writePublicationsOverTimeJSON(VitroRequest vreq, Set<SubEntity> subentities, Map<String, Set<String>> subOrganizationTypesResult) {
|
||||||
|
|
||||||
Gson json = new Gson();
|
Gson json = new Gson();
|
||||||
Set<JsonObject> subEntitiesJson = new HashSet<JsonObject>();
|
Set<JsonObject> subEntitiesJson = new HashSet<JsonObject>();
|
||||||
|
@ -220,7 +211,15 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
entityJson.getOrganizationType().addAll(subOrganizationTypesResult.get(entityJson.getLabel()));
|
entityJson.getOrganizationType().addAll(subOrganizationTypesResult.get(entityJson.getLabel()));
|
||||||
|
|
||||||
entityJson.setEntityURI(subentity.getIndividualURI());
|
entityJson.setEntityURI(subentity.getIndividualURI());
|
||||||
setEntityVisMode(entityJson);
|
|
||||||
|
boolean isPerson = vreq.getWebappDaoFactory().getIndividualDao().getIndividualByURI(subentity.getIndividualURI()).isVClass("http://xmlns.com/foaf/0.1/Person");
|
||||||
|
|
||||||
|
if(isPerson){
|
||||||
|
entityJson.setVisMode("PERSON");
|
||||||
|
} else{
|
||||||
|
entityJson.setVisMode("ORGANIZATION");
|
||||||
|
}
|
||||||
|
// setEntityVisMode(entityJson);
|
||||||
subEntitiesJson.add(entityJson);
|
subEntitiesJson.add(entityJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
|
||||||
+ "}";
|
+ "}";
|
||||||
|
|
||||||
|
|
||||||
//System.out.println("\n\nEntity SubOrganizationTypes query is: "+ sparqlQuery);
|
// System.out.println("\n\nEntity SubOrganizationTypes query is: "+ sparqlQuery);
|
||||||
log.debug("\nThe sparql query is :\n" + sparqlQuery);
|
log.debug("\nThe sparql query is :\n" + sparqlQuery);
|
||||||
|
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
|
@ -146,8 +146,8 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//System.out.println("\n\nSub Organization Label Types Size --> " + subOrganizationLabelToTypes.size());
|
// System.out.println("\n\nSub Organization Label Types Size --> " + subOrganizationLabelToTypes.size());
|
||||||
//System.out.println("\n\nPeople Label Types Size --> " + personLabelToTypes.size());
|
// System.out.println("\n\nPeople Label Types Size --> " + personLabelToTypes.size());
|
||||||
|
|
||||||
return (subOrganizationLabelToTypes.size() != 0 )? subOrganizationLabelToTypes : personLabelToTypes ;
|
return (subOrganizationLabelToTypes.size() != 0 )? subOrganizationLabelToTypes : personLabelToTypes ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,10 +173,12 @@ public class EntityGrantCountQueryRunner implements QueryRunner<Entity> {
|
||||||
entity.addGrants(grant);
|
entity.addGrants(grant);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(subentityURLToVO.size() == 0){
|
if(subentityURLToVO.size() == 0 && personURLToVO.size() != 0){
|
||||||
for(SubEntity person : personURLToVO.values()){
|
for(SubEntity person : personURLToVO.values()){
|
||||||
entity.addSubEntity(person);
|
entity.addSubEntity(person);
|
||||||
}
|
}
|
||||||
|
} else if (subentityURLToVO.size() == 0 && personURLToVO.size() == 0){
|
||||||
|
entity = new Entity(this.entityURI, "no-label");
|
||||||
}
|
}
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
|
|
|
@ -35,10 +35,6 @@ import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.Visual
|
||||||
|
|
||||||
public class EntityGrantCountRequestHandler implements
|
public class EntityGrantCountRequestHandler implements
|
||||||
VisualizationRequestHandler {
|
VisualizationRequestHandler {
|
||||||
|
|
||||||
public static String ENTITY_VIS_MODE;
|
|
||||||
public static String SUB_ENTITY_VIS_MODE;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseValues generateStandardVisualization(
|
public ResponseValues generateStandardVisualization(
|
||||||
|
@ -47,33 +43,27 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
String entityURI = vitroRequest
|
String entityURI = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||||
|
|
||||||
|
|
||||||
QueryRunner<Entity> queryManager = new EntityGrantCountQueryRunner(
|
QueryRunner<Entity> queryManager = new EntityGrantCountQueryRunner(
|
||||||
entityURI, dataSource, log);
|
entityURI, dataSource, log);
|
||||||
Entity entity = queryManager.getQueryResult();
|
|
||||||
|
|
||||||
ENTITY_VIS_MODE = vitroRequest
|
|
||||||
.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY);
|
|
||||||
setVisModes();
|
|
||||||
|
|
||||||
// for(SubEntity se : entity.getSubEntities()){
|
|
||||||
// System.out.println("se key -->" + se.getIndividualLabel());
|
|
||||||
// }
|
|
||||||
|
|
||||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
Entity entity = queryManager.getQueryResult();
|
||||||
entityURI, dataSource, log);
|
|
||||||
|
if(entity.getEntityLabel().equals("no-label")){
|
||||||
|
|
||||||
|
return prepareStandaloneErrorResponse(vitroRequest,entityURI);
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes.getQueryResult();
|
} else{
|
||||||
|
|
||||||
// for(Map.Entry soTR : subOrganizationTypesResult.entrySet()){
|
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||||
// System.out.println("soTR key -->" + soTR.getKey());
|
entityURI, dataSource, log);
|
||||||
// }
|
|
||||||
//
|
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes
|
||||||
// System.out.println();
|
.getQueryResult();
|
||||||
|
|
||||||
return prepareStandaloneResponse(vitroRequest,
|
return prepareStandaloneResponse(vitroRequest, entity, entityURI,
|
||||||
entity,entityURI, subOrganizationTypesResult);
|
subOrganizationTypesResult);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,11 +74,7 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
String entityURI = vitroRequest
|
String entityURI = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||||
|
|
||||||
ENTITY_VIS_MODE = vitroRequest
|
|
||||||
.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY);
|
|
||||||
setVisModes();
|
|
||||||
|
|
||||||
QueryRunner<Entity> queryManager = new EntityGrantCountQueryRunner(
|
QueryRunner<Entity> queryManager = new EntityGrantCountQueryRunner(
|
||||||
entityURI, dataSource, log);
|
entityURI, dataSource, log);
|
||||||
|
|
||||||
|
@ -158,7 +144,7 @@ public class EntityGrantCountRequestHandler implements
|
||||||
String standaloneTemplate = "entityComparisonStandaloneActivator.ftl";
|
String standaloneTemplate = "entityComparisonStandaloneActivator.ftl";
|
||||||
|
|
||||||
String jsonContent = "";
|
String jsonContent = "";
|
||||||
jsonContent = writeGrantsOverTimeJSON(entity.getSubEntities(), subOrganizationTypesResult);
|
jsonContent = writeGrantsOverTimeJSON(vreq, entity.getSubEntities(), subOrganizationTypesResult);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,24 +159,29 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setVisModes() {
|
private ResponseValues prepareStandaloneErrorResponse(
|
||||||
|
VitroRequest vitroRequest, String entityURI) {
|
||||||
|
|
||||||
if (ENTITY_VIS_MODE.equalsIgnoreCase("DEPARTMENT")) {
|
Portal portal = vitroRequest.getPortal();
|
||||||
SUB_ENTITY_VIS_MODE = "PERSON";
|
String standaloneTemplate = "entityComparisonErrorActivator.ftl";
|
||||||
}else if (ENTITY_VIS_MODE.equalsIgnoreCase("SCHOOL")) {
|
|
||||||
SUB_ENTITY_VIS_MODE = "DEPARTMENT";
|
Map<String, Object> body = new HashMap<String, Object>();
|
||||||
}else {
|
body.put("portalBean", portal);
|
||||||
SUB_ENTITY_VIS_MODE = "SCHOOL";
|
body.put("title", "Temporal Graph Visualization");
|
||||||
}
|
body.put("organizationURI", entityURI);
|
||||||
}
|
|
||||||
|
return new TemplateResponseValues(standaloneTemplate, body);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to generate a json file for year <-> grant count mapping
|
* function to generate a json file for year <-> grant count mapping
|
||||||
|
* @param vreq
|
||||||
* @param subentities
|
* @param subentities
|
||||||
* @param subOrganizationTypesResult
|
* @param subOrganizationTypesResult
|
||||||
*/
|
*/
|
||||||
private String writeGrantsOverTimeJSON(Set<SubEntity> subentities, Map<String, Set<String>> subOrganizationTypesResult) {
|
private String writeGrantsOverTimeJSON(VitroRequest vreq, Set<SubEntity> subentities, Map<String, Set<String>> subOrganizationTypesResult) {
|
||||||
|
|
||||||
Gson json = new Gson();
|
Gson json = new Gson();
|
||||||
Set<JsonObject> subEntitiesJson = new HashSet<JsonObject>();
|
Set<JsonObject> subEntitiesJson = new HashSet<JsonObject>();
|
||||||
|
@ -219,7 +210,16 @@ public class EntityGrantCountRequestHandler implements
|
||||||
entityJson.getOrganizationType().addAll(subOrganizationTypesResult.get(entityJson.getLabel()));
|
entityJson.getOrganizationType().addAll(subOrganizationTypesResult.get(entityJson.getLabel()));
|
||||||
|
|
||||||
entityJson.setEntityURI(subentity.getIndividualURI());
|
entityJson.setEntityURI(subentity.getIndividualURI());
|
||||||
setEntityVisMode(entityJson);
|
|
||||||
|
boolean isPerson = vreq.getWebappDaoFactory().getIndividualDao().getIndividualByURI(subentity.getIndividualURI()).isVClass("http://xmlns.com/foaf/0.1/Person");
|
||||||
|
|
||||||
|
if(isPerson){
|
||||||
|
entityJson.setVisMode("PERSON");
|
||||||
|
} else{
|
||||||
|
entityJson.setVisMode("ORGANIZATION");
|
||||||
|
}
|
||||||
|
|
||||||
|
// setEntityVisMode(entityJson);
|
||||||
subEntitiesJson.add(entityJson);
|
subEntitiesJson.add(entityJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,17 +228,6 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setEntityVisMode(JsonObject entityJson) {
|
|
||||||
|
|
||||||
if(entityJson.getOrganizationType().contains("Department")){
|
|
||||||
entityJson.setVisMode("DEPARTMENT");
|
|
||||||
}else if(entityJson.getOrganizationType().contains("School")){
|
|
||||||
entityJson.setVisMode("SCHOOL");
|
|
||||||
}else{
|
|
||||||
entityJson.setVisMode(SUB_ENTITY_VIS_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getEntityGrantsPerYearCSVContent(Set<SubEntity> subentities, Map<String, Set<String>> subOrganizationTypesResult) {
|
private String getEntityGrantsPerYearCSVContent(Set<SubEntity> subentities, Map<String, Set<String>> subOrganizationTypesResult) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue