Fixing the issue with PersonGrantCountRequestHandler
This commit is contained in:
parent
c22b104816
commit
821f4ae2c3
2 changed files with 80 additions and 182 deletions
|
@ -34,7 +34,6 @@ import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
||||||
* Deepak Konidena
|
* Deepak Konidena
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PersonGrantCountQueryRunner implements QueryRunner<Set<Grant>>{
|
public class PersonGrantCountQueryRunner implements QueryRunner<Set<Grant>>{
|
||||||
|
|
||||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||||
|
@ -157,104 +156,5 @@ public class PersonGrantCountQueryRunner implements QueryRunner<Set<Grant>>{
|
||||||
|
|
||||||
return createJavaValueObjects(resultSet);
|
return createJavaValueObjects(resultSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationFrameworkConstants;
|
import edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationFrameworkConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.BiboDocument;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Individual;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Grant;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Grant;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SparklineData;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SparklineData;
|
||||||
|
@ -39,7 +38,6 @@ import edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.VisualizationRequestHandler;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.VisualizationRequestHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This request handler is used to serve the content related to an individual's
|
* This request handler is used to serve the content related to an individual's
|
||||||
|
@ -79,30 +77,30 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
||||||
VisualizationFrameworkConstants
|
VisualizationFrameworkConstants
|
||||||
.VIS_CONTAINER_KEY);
|
.VIS_CONTAINER_KEY);
|
||||||
|
|
||||||
QueryRunner<Set<BiboDocument>> queryManager =
|
QueryRunner<Set<Grant>> queryManager =
|
||||||
new PersonGrantCountQueryRunner(personURI, dataSource, log);
|
new PersonGrantCountQueryRunner(personURI, dataSource, log);
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
Set<Grant> authorDocuments = queryManager.getQueryResult();
|
// Set<Grant> authorDocuments = queryManager.getQueryResult();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a map from the year to number of publications. Use the BiboDocument's
|
* Create a map from the year to number of publications. Use the BiboDocument's
|
||||||
* parsedPublicationYear to populate the data.
|
* parsedPublicationYear to populate the data.
|
||||||
* */
|
* */
|
||||||
Map<String, Integer> yearToPublicationCount =
|
// Map<String, Integer> yearToPublicationCount =
|
||||||
UtilityFunctions.getYearToPublicationCount(authorDocuments);
|
// UtilityFunctions.getYearToPublicationCount(authorDocuments);
|
||||||
|
//
|
||||||
Individual author = ((PersonGrantCountQueryRunner) queryManager).getAuthor();
|
// Individual author = ((PersonGrantCountQueryRunner) queryManager).getAuthor();
|
||||||
|
//
|
||||||
if (VisualizationFrameworkConstants.DATA_RENDER_MODE
|
// if (VisualizationFrameworkConstants.DATA_RENDER_MODE
|
||||||
.equalsIgnoreCase(renderMode)) {
|
// .equalsIgnoreCase(renderMode)) {
|
||||||
|
//
|
||||||
prepareDataResponse(author,
|
// prepareDataResponse(author,
|
||||||
authorDocuments,
|
// authorDocuments,
|
||||||
yearToPublicationCount,
|
// yearToPublicationCount,
|
||||||
response);
|
// response);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -123,66 +121,66 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
||||||
/*
|
/*
|
||||||
* Computations required to generate HTML for the sparkline & related context.
|
* Computations required to generate HTML for the sparkline & related context.
|
||||||
* */
|
* */
|
||||||
PersonGrantCountVisCodeGenerator visualizationCodeGenerator =
|
// PersonGrantCountVisCodeGenerator visualizationCodeGenerator =
|
||||||
new PersonGrantCountVisCodeGenerator(vitroRequest.getContextPath(),
|
// new PersonGrantCountVisCodeGenerator(vitroRequest.getContextPath(),
|
||||||
personURI,
|
// personURI,
|
||||||
visMode,
|
// visMode,
|
||||||
visContainer,
|
// visContainer,
|
||||||
authorDocuments,
|
// authorDocuments,
|
||||||
yearToPublicationCount,
|
// yearToPublicationCount,
|
||||||
log);
|
// log);
|
||||||
|
//
|
||||||
SparklineData sparklineData = visualizationCodeGenerator
|
// SparklineData sparklineData = visualizationCodeGenerator
|
||||||
.getValueObjectContainer();
|
// .getValueObjectContainer();
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* This is side-effecting because the response of this method is just to redirect to
|
// * This is side-effecting because the response of this method is just to redirect to
|
||||||
* a page with visualization on it.
|
// * a page with visualization on it.
|
||||||
* */
|
// * */
|
||||||
RequestDispatcher requestDispatcher = null;
|
// RequestDispatcher requestDispatcher = null;
|
||||||
|
//
|
||||||
if (VisualizationFrameworkConstants.DYNAMIC_RENDER_MODE
|
// if (VisualizationFrameworkConstants.DYNAMIC_RENDER_MODE
|
||||||
.equalsIgnoreCase(renderMode)) {
|
// .equalsIgnoreCase(renderMode)) {
|
||||||
|
//
|
||||||
prepareDynamicResponse(request,
|
// prepareDynamicResponse(request,
|
||||||
response,
|
// response,
|
||||||
vitroRequest,
|
// vitroRequest,
|
||||||
sparklineData,
|
// sparklineData,
|
||||||
yearToPublicationCount);
|
// yearToPublicationCount);
|
||||||
requestDispatcher = request.getRequestDispatcher("/templates/page/blankPage.jsp");
|
// requestDispatcher = request.getRequestDispatcher("/templates/page/blankPage.jsp");
|
||||||
|
//
|
||||||
} else {
|
// } else {
|
||||||
prepareStandaloneResponse(request,
|
// prepareStandaloneResponse(request,
|
||||||
response,
|
// response,
|
||||||
vitroRequest,
|
// vitroRequest,
|
||||||
sparklineData);
|
// sparklineData);
|
||||||
requestDispatcher = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
// requestDispatcher = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
requestDispatcher.forward(request, response);
|
// requestDispatcher.forward(request, response);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
log.error("EntityEditController could not forward to view.");
|
// log.error("EntityEditController could not forward to view.");
|
||||||
log.error(e.getMessage());
|
// log.error(e.getMessage());
|
||||||
log.error(e.getStackTrace());
|
// log.error(e.getStackTrace());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
} catch (MalformedQueryParametersException e) {
|
// } catch (MalformedQueryParametersException e) {
|
||||||
try {
|
// try {
|
||||||
UtilityFunctions.handleMalformedParameters(
|
// UtilityFunctions.handleMalformedParameters(
|
||||||
e.getMessage(),
|
// e.getMessage(),
|
||||||
"Visualization Query Error - Individual Publication Count",
|
// "Visualization Query Error - Individual Publication Count",
|
||||||
vitroRequest,
|
// vitroRequest,
|
||||||
request,
|
// request,
|
||||||
response,
|
// response,
|
||||||
log);
|
// log);
|
||||||
} catch (ServletException e1) {
|
// } catch (ServletException e1) {
|
||||||
log.error(e1.getStackTrace());
|
// log.error(e1.getStackTrace());
|
||||||
} catch (IOException e1) {
|
// } catch (IOException e1) {
|
||||||
log.error(e1.getStackTrace());
|
// log.error(e1.getStackTrace());
|
||||||
}
|
// }
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writePublicationsOverTimeCSV(
|
private void writePublicationsOverTimeCSV(
|
||||||
|
@ -216,7 +214,7 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
||||||
*/
|
*/
|
||||||
private void prepareDataResponse(
|
private void prepareDataResponse(
|
||||||
Individual author,
|
Individual author,
|
||||||
Set<BiboDocument> authorDocuments,
|
Set<Grant> authorDocuments,
|
||||||
Map<String, Integer> yearToPublicationCount,
|
Map<String, Integer> yearToPublicationCount,
|
||||||
HttpServletResponse response) {
|
HttpServletResponse response) {
|
||||||
|
|
||||||
|
@ -313,7 +311,7 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preparePDFResponse(Individual author,
|
private void preparePDFResponse(Individual author,
|
||||||
Set<BiboDocument> authorDocuments,
|
Set<Grant> authorDocuments,
|
||||||
Map<String, Integer> yearToPublicationCount,
|
Map<String, Integer> yearToPublicationCount,
|
||||||
HttpServletResponse response) {
|
HttpServletResponse response) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue