From 24795af66538fe3cd484d84e087f2dcdb0be7e71 Mon Sep 17 00:00:00 2001 From: cdtank Date: Thu, 10 Feb 2011 16:19:16 +0000 Subject: [PATCH] 1. Making a change to send an organization label to the error response for temporal graoph vis. If the organization uri is invalid then we send "Unknown Organization" --- .../entityComparisonErrorCommonBody.ftl | 2 ++ .../EntityPublicationCountRequestHandler.java | 16 ++++++++++++++-- .../EntityGrantCountRequestHandler.java | 18 ++++++++++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonErrorCommonBody.ftl b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonErrorCommonBody.ftl index a0999e1b..b47af0a0 100644 --- a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonErrorCommonBody.ftl +++ b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonErrorCommonBody.ftl @@ -6,6 +6,8 @@ <#assign temporalGraphURL = '${urls.base}${standardVisualizationURLRoot}?vis=${otherVisType}&uri=${organizationURI}&labelField=label'>
+ +${organizationLabel}

Visit the Temporal Graph for ${textForOtherEntityComparisonType} of the Organization.

This Organization has neither Sub-Organizations nor People with ${textForCurrentEntityComparisonType} in VIVO. Please visit the Organization's profile page.

diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java index d69c403e..71237186 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java @@ -23,12 +23,14 @@ import com.hp.hpl.jena.rdf.model.Model; import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties; +import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Portal; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.visualization.freemarker.DataVisualizationController; import edu.cornell.mannlib.vitro.webapp.controller.visualization.freemarker.VisualizationFrameworkConstants; +import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants; import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Entity; @@ -237,10 +239,20 @@ public class EntityPublicationCountRequestHandler implements Portal portal = vitroRequest.getPortal(); String standaloneTemplate = "entityPublicationComparisonError.ftl"; - Map body = new HashMap(); + + IndividualDao iDao = vitroRequest.getWebappDaoFactory().getIndividualDao(); + Individual ind = iDao.getIndividualByURI(entityURI); + + String organizationLabel = "Unknown Organization"; + + if (ind != null) { + organizationLabel = ind.getName(); + } + + body.put("organizationLabel", organizationLabel); body.put("portalBean", portal); - body.put("title", "Temporal Graph Visualization"); + body.put("title", organizationLabel + " - Temporal Graph Visualization"); body.put("organizationURI", entityURI); return new TemplateResponseValues(standaloneTemplate, body); diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitygrantcount/EntityGrantCountRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitygrantcount/EntityGrantCountRequestHandler.java index 577ef9d6..eb2b8b5b 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitygrantcount/EntityGrantCountRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitygrantcount/EntityGrantCountRequestHandler.java @@ -22,12 +22,14 @@ import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.rdf.model.Model; import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties; +import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Portal; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.visualization.freemarker.DataVisualizationController; import edu.cornell.mannlib.vitro.webapp.controller.visualization.freemarker.VisualizationFrameworkConstants; +import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants; import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.entitycomparison.EntityComparisonUtilityFunctions; @@ -236,10 +238,22 @@ public class EntityGrantCountRequestHandler implements Portal portal = vitroRequest.getPortal(); String standaloneTemplate = "entityGrantComparisonError.ftl"; - Map body = new HashMap(); + + IndividualDao iDao = vitroRequest.getWebappDaoFactory().getIndividualDao(); + Individual ind = iDao.getIndividualByURI(entityURI); + + String organizationLabel = "Unknown Organization"; + + if (ind != null) { + organizationLabel = ind.getName(); + } + + body.put("organizationLabel", organizationLabel); + + body.put("portalBean", portal); - body.put("title", "Temporal Graph Visualization"); + body.put("title", organizationLabel + " - Temporal Graph Visualization"); body.put("organizationURI", entityURI); return new TemplateResponseValues(standaloneTemplate, body);