Skip to content

Commit

Permalink
VIVO-4000 Removed text from csv export template. Added date and site …
Browse files Browse the repository at this point in the history
…name to export csv file.
  • Loading branch information
litvinovg committed Sep 9, 2024
1 parent fcf4398 commit 322e87e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package edu.cornell.mannlib.vitro.webapp.search.controller;

import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
Expand Down Expand Up @@ -124,7 +126,10 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro

response.setCharacterEncoding("UTF-8");
response.setContentType("text/csv;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment; filename=search.csv");
String date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HHmmss"));
String applicationName = vreq.getAppBean().getApplicationName();
String fileName = date + "_" + applicationName + "_searchterm.csv";
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
writeTemplate(rvalues.getTemplateName(), rvalues.getMap(), request, response);
} catch (Exception e) {
log.error(e, e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<#-- $This file is distributed under the terms of the license in LICENSE$ -->
<#assign today = .now >
<#assign todayDate = today?date>
Results from ${siteName} for ${querytext} on ${todayDate}

Name, URI, URL
<#list individuals as individual>
"${individual.name}","${individual.uri}","${individual.profileUrl}"
Expand Down

0 comments on commit 322e87e

Please sign in to comment.