Commit fa0c6b78 authored by Andrey Lugovskiy's avatar Andrey Lugovskiy
Browse files

end

parent bf2e677e
Pipeline #492 passed with stage
in 49 seconds
......@@ -43,6 +43,7 @@ public class ApplicationController {
model.addAttribute("result", processService.process(file, separator, quoteChar, escapeChar, coyFromExcel, toCurrentTaxa).toString());
model.addAttribute("newLineSymbol", "\n");
model.addAttribute("symbolQuote", "\"");
model.addAttribute("separator", separator);
return "result";
}
}
......@@ -44,8 +44,8 @@ public class ProcessServiceImpl implements ProcessService {
@Override
public StringWriter process(MultipartFile file, Character separator, Character quoteChar, Character escapeChar,
String coyFromExcel, Boolean toCurrentTaxa) throws ParseException, IOException, TaxonomyException {
LOG.info("Start process with file: '{}', separator: '{}', coyFromExcel: '{}', toCurrentTaxa: '{}'",
file.getOriginalFilename(), separator, coyFromExcel, toCurrentTaxa);
LOG.info("Start process with file: '{}', separator: '{}', toCurrentTaxa: '{}'",
file.getOriginalFilename(), separator, toCurrentTaxa);
readDatabase(applicationProperties.getDatabaseFolderPath());
return run(file.getInputStream(), separator, quoteChar, escapeChar, coyFromExcel, toCurrentTaxa);
}
......@@ -80,10 +80,18 @@ public class ProcessServiceImpl implements ProcessService {
taxonomyChecker.setTaxonomyDatabase(taxonomyDatabase);
LOG.info("Running the validation against {}", taxonomyDatabase);
try (CSVReader reader = new CSVReader(new InputStreamReader(inputStream, "UTF-8"), separator,
Reader reader;
if (coyFromExcel != null && !coyFromExcel.isEmpty()){
reader = new StringReader(coyFromExcel);
}else{
reader = new InputStreamReader(inputStream, "UTF-8");
}
try (CSVReader csvReader = new CSVReader(reader, separator,
quoteChar, escapeChar, 0, false, true, false)) {
String[] headers = reader.readNext();
String[] headers = csvReader.readNext();
LOG.debug("Input CSV headers: {}", Arrays.toString(headers));
{
......@@ -181,7 +189,7 @@ public class ProcessServiceImpl implements ProcessService {
String[] sourceLine;
while ((sourceLine = reader.readNext()) != null) {
while ((sourceLine = csvReader.readNext()) != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("\n\n");
......
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
......@@ -7,17 +7,21 @@
<head>
<title><spring:message code="label.title"/></title>
<style>
.div1 { display: inline;
.div1 {
display: inline;
min-width: 90px;
width: 90px;}
width: 90px;
}
</style>
</head>
<body>
<c:forEach items='${fn:split(result, newLineSymbol )}' var="row">
<div class="">
<c:forEach items='${fn:split(row, ",")}' var="element">
<div class="div1"><c:out value="${fn:replace(element, symbolQuote, '')}"/></div>
</c:forEach>
<c:forEach items="${fn:split(fn:replace(row, ',', ' , '), ',')}" var="element">
<div class="div1">
<c:out value="${element}"/>
</div>
</c:forEach>;
</div>
</c:forEach>
</body>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment