Commit 6822d645 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '6-number-format-support' into 'master'

added number format support

Closes #6

See merge request !5
parents 3d08b4ea c01aa31b
......@@ -19,10 +19,15 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.text.ParseException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.genesys.geotools.service.CountryOfOriginService;
import org.genesys.geotools.service.LandOrSeaService;
import org.genesys.geotools.service.impl.CountryOfOriginServiceImpl;
import org.genesys.geotools.service.impl.LandOrSeaServiceImpl;
import org.genesys.taxonomy.checker.InMemoryTaxonomyDatabase;
import org.genesys.taxonomy.checker.TaxonomyChecker;
import org.genesys.taxonomy.checker.TaxonomyException;
......@@ -32,7 +37,7 @@ import org.genesys.taxonomy.checker.web.service.impl.CountryProcessServiceImpl;
import org.genesys.taxonomy.checker.web.service.impl.LandOrSeaProcessServiceImpl;
import org.genesys.taxonomy.checker.web.service.impl.ProcessServiceImpl;
import org.genesys.taxonomy.checker.web.service.impl.TaxonomyProcessServiceImpl;
import org.genesys.taxonomy.checker.web.staurtap.StartupInitializer;
import org.genesys.taxonomy.checker.web.startup.StartupInitializer;
import org.genesys.taxonomy.download.TaxonomyDownloader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -95,6 +100,20 @@ public class ApplicationConfig {
public ProcessService processService(){
return new ProcessServiceImpl();
}
@Bean
public LandOrSeaService landOrSeaService() throws MalformedURLException, IOException {
LandOrSeaServiceImpl s = new LandOrSeaServiceImpl();
s.afterPropertiesSet();
return s;
}
@Bean
public CountryOfOriginService countryOfOriginService() throws MalformedURLException, IOException {
CountryOfOriginServiceImpl s = new CountryOfOriginServiceImpl();
s.afterPropertiesSet();
return s;
}
private void downloadDataIfNeeded() throws IOException {
......
......@@ -81,12 +81,13 @@ public class ValidatorController {
@RequestParam(name = "escapeChar", required = false, defaultValue = "0") final Character escapeChar,
@RequestParam(name = "toCurrentTaxa", required = false) final Boolean toCurrentTaxa,
@RequestParam(name = "validateType", required = false, defaultValue = "") final String validateType,
@RequestParam(name = "decimalMark", defaultValue = ".") final Character decimalMark,
final ModelMap model) throws IOException, ParseException, TaxonomyException {
LOG.info("Processing uploaded file");
try (Reader reader = new InputStreamReader(file.getInputStream())) {
List<String[]> rows = processService.process(reader, separator, quoteChar, escapeChar, validateType, toCurrentTaxa);
List<String[]> rows = processService.process(reader, separator, quoteChar, escapeChar, validateType, toCurrentTaxa, decimalMark);
model.addAttribute("result", rows);
model.addAttribute("tableHeaders", rows.get(0));
model.addAttribute("newLineSymbol", "\n");
......@@ -117,11 +118,13 @@ public class ValidatorController {
@RequestParam(name = "escapeChar", required = false, defaultValue = "0") final Character escapeChar, @RequestParam(name = "csvText", required = true) final String csvText,
@RequestParam(name = "toCurrentTaxa", required = false) final Boolean toCurrentTaxa,
@RequestParam(name = "validateType", defaultValue = "") final String validateType,
@RequestParam(name = "decimalMark", defaultValue = ".") final Character decimalMark,
final ModelMap model) throws IOException, ParseException, TaxonomyException {
LOG.info("Processing uploaded CSV string");
List<String[]> rows = processService.process(new StringReader(StringUtils.defaultString(csvText, "")), separator, quoteChar, escapeChar, validateType, toCurrentTaxa);
List<String[]> rows = processService.process(new StringReader(StringUtils.defaultString(csvText, "")), separator, quoteChar, escapeChar, validateType,
toCurrentTaxa, decimalMark);
model.addAttribute("result", rows);
model.addAttribute("tableHeaders", rows.get(0));
model.addAttribute("newLineSymbol", "\n");
......
......@@ -17,6 +17,8 @@ package org.genesys.taxonomy.checker.web.service;
import java.io.IOException;
import java.io.Reader;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException;
import java.util.List;
......@@ -42,6 +44,22 @@ public interface ProcessService {
* @throws IOException Signals that an I/O exception has occurred.
* @throws TaxonomyException the taxonomy exception
*/
List<String[]> process(Reader reader, Character separator, Character quoteChar, Character escapeChar, String validateType, Boolean toCurrentTaxa) throws ParseException, IOException, TaxonomyException;
List<String[]> process(Reader reader, Character separator, Character quoteChar, Character escapeChar, String validateType, Boolean toCurrentTaxa, Character decimalMark)
throws ParseException, IOException, TaxonomyException;
/**
* Create instance of DecimalFormat used to parse numbers from the CSV
* @param decimalMark
* @return DecimalFormat using the specified decimal mark
*/
default DecimalFormat createDecimalFormat(char decimalMark) {
final DecimalFormat decimalFormat = new DecimalFormat();
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator(decimalMark);
symbols.setGroupingSeparator(decimalMark == ',' ? '.' : ',');
decimalFormat.setDecimalFormatSymbols(symbols);
decimalFormat.setMinimumFractionDigits(8);
return decimalFormat;
}
}
package org.genesys.taxonomy.checker.web.service.impl;
import com.opencsv.CSVReader;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.genesys.geotools.service.HeaderUtils;
import org.genesys.geotools.service.impl.CountryOfOriginServiceImpl;
import org.genesys.taxonomy.checker.TaxonomyException;
import org.genesys.taxonomy.checker.web.service.ProcessService;
import org.genesys.taxonomy.checker.web.util.ApplicationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.Reader;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -26,6 +14,21 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.genesys.geotools.service.CountryOfOriginService;
import org.genesys.geotools.service.HeaderUtils;
import org.genesys.taxonomy.checker.TaxonomyException;
import org.genesys.taxonomy.checker.web.service.ProcessService;
import org.genesys.taxonomy.checker.web.util.ApplicationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.opencsv.CSVReader;
/**
* @author Andrey Lugovskoy.
*/
......@@ -34,13 +37,18 @@ public class CountryProcessServiceImpl implements ProcessService {
private final static Logger LOG = LoggerFactory.getLogger(CountryProcessServiceImpl.class);
@Autowired
private CountryOfOriginService countryOfOriginService;
@Override
public List<String[]> process(Reader reader, Character separator, Character quoteChar, Character escapeChar, String validateType, Boolean toCurrentTaxa)
public List<String[]> process(Reader reader, Character separator, Character quoteChar, Character escapeChar, String validateType, Boolean toCurrentTaxa, Character decimalMark)
throws ParseException, IOException, TaxonomyException {
return execute(reader, separator, quoteChar, escapeChar);
return execute(reader, separator, quoteChar, escapeChar, decimalMark);
}
private List<String[]> execute(Reader readerr, char separatorChar, char quoteChar, char escapeChar) throws IOException {
private List<String[]> execute(Reader readerr, char separatorChar, char quoteChar, char escapeChar, Character decimalMark) throws IOException {
final DecimalFormat decimalFormat = createDecimalFormat(decimalMark);
final List<String[]> lines = new LinkedList<>();
......@@ -69,18 +77,27 @@ public class CountryProcessServiceImpl implements ProcessService {
outputHeaders.add(pos + 1, ApplicationUtils.HEADER_ORIGCTY_CHECK);
outputMapping.add(pos + 1, null);
}
// Add extra header HEADER_DECLATITUDE_CHECK
{
int pos = outputHeaders.indexOf(ApplicationUtils.HEADER_LATITUDE);
outputHeaders.add(pos + 1, ApplicationUtils.HEADER_DECLATITUDE_CHECK);
outputMapping.add(pos + 1, null);
}
// Add extra header HEADER_DECLONGITUDE_CHECK
{
int pos = outputHeaders.indexOf(ApplicationUtils.HEADER_LONGITUDE);
outputHeaders.add(pos + 1, ApplicationUtils.HEADER_DECLONGITUDE_CHECK);
outputMapping.add(pos + 1, null);
}
LOG.info("Output headers: {}", outputHeaders);
LOG.info("Source mapping indexes: {}", outputMapping);
lines.add(outputHeaders.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
CountryOfOriginServiceImpl countryOfOriginService = new CountryOfOriginServiceImpl();
countryOfOriginService.afterPropertiesSet();
// Thread pool with nThreads concurrent threads
int nThreads = Math.max(Runtime.getRuntime().availableProcessors() - 1, 1);
LOG.info("Using " + nThreads + " threads for " + Runtime.getRuntime().availableProcessors() + " CPUs.");
LOG.info("Using {} threads for {} CPUs.", nThreads, Runtime.getRuntime().availableProcessors());
BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(nThreads * 2);
......@@ -103,8 +120,7 @@ public class CountryProcessServiceImpl implements ProcessService {
stopWatch.split();
long processingTimeSeconds = stopWatch.getSplitTime() / 1000;
if ((lineCount % 1000 == 0 && processingTimeSeconds > 0) || (lastLogTime != processingTimeSeconds && processingTimeSeconds % 10 == 0)) {
LOG.info("FYI, " + lineCount + " entries have been processed in " + processingTimeSeconds + " = " + (lineCount / processingTimeSeconds) + " lines/second");
countryOfOriginService.printCache();
LOG.info("FYI, {} entries have been processed in {}s = {} lines/second", lineCount, processingTimeSeconds, ((float)lineCount / processingTimeSeconds));
lastLogTime = processingTimeSeconds;
}
......@@ -129,14 +145,17 @@ public class CountryProcessServiceImpl implements ProcessService {
// if ("101346".equals(nextLine[0])) {
// LOG.info("!!! Got what we're looking for");
// }
String declongitude = nextLine[sourceMapping.get(ApplicationUtils.HEADER_LONGITUDE)].trim();
String declatitude = nextLine[sourceMapping.get(ApplicationUtils.HEADER_LATITUDE)].trim();
String declongitude = StringUtils.trimToNull(nextLine[sourceMapping.get(ApplicationUtils.HEADER_LONGITUDE)]);
String declatitude = StringUtils.trimToNull(nextLine[sourceMapping.get(ApplicationUtils.HEADER_LATITUDE)]);
String origCty = nextLine[sourceMapping.get(ApplicationUtils.HEADER_ORIGCTY)].trim();
if (StringUtils.isNotBlank(declatitude) && StringUtils.isNotBlank(declongitude)) {
try {
float longitude = Float.parseFloat(declongitude);
float latitude = Float.parseFloat(declatitude);
float longitude = decimalFormat.parse(declongitude).floatValue();
float latitude = decimalFormat.parse(declatitude).floatValue();
LOG.debug("Parsed DECLATITUDE/DECLONGITUDE ({}, {}) --> ({}, {})", declongitude, declatitude, longitude, latitude);
outputLine[outputHeaders.indexOf(ApplicationUtils.HEADER_DECLATITUDE_CHECK)] = decimalFormat.format(latitude);
outputLine[outputHeaders.indexOf(ApplicationUtils.HEADER_DECLONGITUDE_CHECK)] = decimalFormat.format(longitude);
try {
result = countryOfOriginService.getCountries(longitude, latitude, origCty, ApplicationUtils.ALLOWED_DISTANCE_MARGIN);
......@@ -178,13 +197,8 @@ public class CountryProcessServiceImpl implements ProcessService {
LOG.info("Shut down.");
stopWatch.stop();
long processingTimeSeconds = stopWatch.getTime() / 1000;
try {
LOG.info("FYI, " + lineCount + " entries have been processed in " + processingTimeSeconds + " = " + (lineCount / processingTimeSeconds) + " lines/second");
} catch (Exception e) {
LOG.info("FYI, " + lineCount + " entries have been processed in " + processingTimeSeconds);
}
countryOfOriginService.printCache();
long processingTimeSeconds = Math.max(1, stopWatch.getTime() / 1000);
LOG.info("FYI, {} entries have been processed in {}s = {}lines/ms = {}ms/line", lineCount, processingTimeSeconds, ((float) lineCount / stopWatch.getTime()), ((float) stopWatch.getTime() / lineCount));
}
return lines;
}
......
package org.genesys.taxonomy.checker.web.service.impl;
import com.opencsv.CSVReader;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.genesys.geotools.service.HeaderUtils;
import org.genesys.geotools.service.impl.LandOrSeaServiceImpl;
import org.genesys.taxonomy.checker.TaxonomyException;
import org.genesys.taxonomy.checker.web.service.ProcessService;
import org.genesys.taxonomy.checker.web.util.ApplicationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.Reader;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -26,6 +14,21 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.genesys.geotools.service.HeaderUtils;
import org.genesys.geotools.service.LandOrSeaService;
import org.genesys.taxonomy.checker.TaxonomyException;
import org.genesys.taxonomy.checker.web.service.ProcessService;
import org.genesys.taxonomy.checker.web.util.ApplicationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.opencsv.CSVReader;
/**
* @author Andrey Lugovskoy.
*/
......@@ -34,16 +37,22 @@ public class LandOrSeaProcessServiceImpl implements ProcessService {
private final static Logger LOG = LoggerFactory.getLogger(LandOrSeaProcessServiceImpl.class);
@Autowired
private LandOrSeaService landOrSeaService;
@Override
public List<String[]> process(Reader reader, Character separator, Character quoteChar, Character escapeChar, String validateType, Boolean toCurrentTaxa)
public List<String[]> process(Reader reader, Character separator, Character quoteChar, Character escapeChar, String validateType, Boolean toCurrentTaxa, Character decimalMark)
throws ParseException, IOException, TaxonomyException {
return execute(reader, separator, quoteChar, escapeChar);
return execute(reader, separator, quoteChar, escapeChar, decimalMark);
}
/* (non-Javadoc)
* @see org.genesys.geotools.cli.GeoTool#execute(java.io.InputStream, java.io.OutputStream, char, char, char)
*/
public List<String[]> execute(Reader readerr, char separatorChar, char quoteChar, char escapeChar) throws IOException {
public List<String[]> execute(Reader readerr, char separatorChar, char quoteChar, char escapeChar, char decimalMark) throws IOException {
final DecimalFormat decimalFormat = createDecimalFormat(decimalMark);
final List<String[]> lines = new LinkedList<>();
......@@ -64,9 +73,21 @@ public class LandOrSeaProcessServiceImpl implements ProcessService {
Map<String, Integer> sourceMapping = HeaderUtils.makeSourceMapping(headers, new String[] { ApplicationUtils.HEADER_LONGITUDE, ApplicationUtils.HEADER_LATITUDE });
// Add extra header
// Add extra header HEADER_DECLATITUDE_CHECK
{
int pos = Math.max(outputHeaders.indexOf(ApplicationUtils.HEADER_LONGITUDE), outputHeaders.indexOf(ApplicationUtils.HEADER_LATITUDE));
int pos = outputHeaders.indexOf(ApplicationUtils.HEADER_LATITUDE);
outputHeaders.add(pos + 1, ApplicationUtils.HEADER_DECLATITUDE_CHECK);
outputMapping.add(pos + 1, null);
}
// Add extra header HEADER_DECLONGITUDE_CHECK
{
int pos = outputHeaders.indexOf(ApplicationUtils.HEADER_LONGITUDE);
outputHeaders.add(pos + 1, ApplicationUtils.HEADER_DECLONGITUDE_CHECK);
outputMapping.add(pos + 1, null);
}
// Add extra header HEADER_LANDORSEA_CHECK
{
int pos = Math.max(outputHeaders.indexOf(ApplicationUtils.HEADER_DECLONGITUDE_CHECK), outputHeaders.indexOf(ApplicationUtils.HEADER_DECLATITUDE_CHECK));
outputHeaders.add(pos + 1, ApplicationUtils.HEADER_LANDORSEA_CHECK);
outputMapping.add(pos + 1, null);
}
......@@ -76,12 +97,9 @@ public class LandOrSeaProcessServiceImpl implements ProcessService {
lines.add(outputHeaders.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
LandOrSeaServiceImpl landOrSeaService = new LandOrSeaServiceImpl();
landOrSeaService.afterPropertiesSet();
// Thread pool with nThreads concurrent threads(TEST!!!!)
int nThreads = Math.max(Runtime.getRuntime().availableProcessors() - 1, 1);
LOG.info("Using " + nThreads + " threads for " + Runtime.getRuntime().availableProcessors() + " CPUs.");
LOG.info("Using {} threads for {} CPUs.", nThreads, Runtime.getRuntime().availableProcessors());
BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(nThreads * 2);
......@@ -103,7 +121,7 @@ public class LandOrSeaProcessServiceImpl implements ProcessService {
stopWatch.split();
long processingTimeSeconds = stopWatch.getSplitTime() / 1000;
if ((lineCount % 1000 == 0 && processingTimeSeconds > 0) || (lastLogTime != processingTimeSeconds && processingTimeSeconds % 10 == 0)) {
LOG.info("FYI, " + lineCount + " entries have been processed in " + processingTimeSeconds + " = " + (lineCount / processingTimeSeconds) + " lines/second");
LOG.info("FYI, {} entries have been processed in {}s = {} lines/second", lineCount, processingTimeSeconds, ((float)lineCount / processingTimeSeconds));
lastLogTime = processingTimeSeconds;
}
......@@ -124,18 +142,22 @@ public class LandOrSeaProcessServiceImpl implements ProcessService {
String[] outputLine = HeaderUtils.toOutputLine(nextLine, outputHeaders, outputMapping);
String declongitude = nextLine[sourceMapping.get(ApplicationUtils.HEADER_LONGITUDE)].trim();
String declatitude = nextLine[sourceMapping.get(ApplicationUtils.HEADER_LATITUDE)].trim();
String declongitude = StringUtils.trimToNull(nextLine[sourceMapping.get(ApplicationUtils.HEADER_LONGITUDE)]);
String declatitude = StringUtils.trimToNull(nextLine[sourceMapping.get(ApplicationUtils.HEADER_LATITUDE)]);
String result = null;
if (StringUtils.isNotBlank(declatitude) && StringUtils.isNotBlank(declongitude)) {
try {
float longitude = Float.parseFloat(declongitude);
float latitude = Float.parseFloat(declatitude);
float longitude = decimalFormat.parse(declongitude).floatValue();
float latitude = decimalFormat.parse(declatitude).floatValue();
LOG.debug("Parsed DECLATITUDE/DECLONGITUDE ({}, {}) --> ({}, {})", declongitude, declatitude, longitude, latitude);
outputLine[outputHeaders.indexOf(ApplicationUtils.HEADER_DECLATITUDE_CHECK)] = decimalFormat.format(latitude);
outputLine[outputHeaders.indexOf(ApplicationUtils.HEADER_DECLONGITUDE_CHECK)] = decimalFormat.format(longitude);
result = landOrSeaService.classifyLocation(longitude, latitude, ApplicationUtils.ALLOWED_DISTANCE_MARGIN);
} catch (Exception e) {
LOG.debug("Error parsing lat/lon", e);
if (e.getCause() != null)
result = "ERROR: " + e.getCause().getMessage();
else
......@@ -149,7 +171,7 @@ public class LandOrSeaProcessServiceImpl implements ProcessService {
}
}
});
} while (true);
LOG.info("Shutting down");
......@@ -165,8 +187,8 @@ public class LandOrSeaProcessServiceImpl implements ProcessService {
LOG.info("Shut down.");
stopWatch.stop();
long processingTimeSeconds = Math.max(1, stopWatch.getTime() / 1000);
LOG.info("FYI, " + lineCount + " entries have been processed in " + processingTimeSeconds + " = " + (lineCount / processingTimeSeconds) + " lines/second");
long processingTimeSeconds = Math.max(1, stopWatch.getTime() / 1000);
LOG.info("FYI, {} entries have been processed in {}s = {}lines/ms = {}ms/line", lineCount, processingTimeSeconds, ((float) lineCount / stopWatch.getTime()), ((float) stopWatch.getTime() / lineCount));
}
return lines;
......
......@@ -35,9 +35,9 @@ public class ProcessServiceImpl implements ProcessService, InitializingBean {
private Map<String, ProcessService> serviceMap;
@Override
public List<String[]> process(Reader reader, Character separator, Character quoteChar, Character escapeChar, String validateType, Boolean toCurrentTaxa)
public List<String[]> process(Reader reader, Character separator, Character quoteChar, Character escapeChar, String validateType, Boolean toCurrentTaxa, Character decimalMark)
throws ParseException, IOException, TaxonomyException {
return serviceMap.get(validateType).process(reader, separator, quoteChar, escapeChar, validateType, toCurrentTaxa);
return serviceMap.get(validateType).process(reader, separator, quoteChar, escapeChar, validateType, toCurrentTaxa, decimalMark);
}
@Override
......
......@@ -118,13 +118,13 @@ public class TaxonomyProcessServiceImpl implements ProcessService {
* @see org.genesys.taxonomy.checker.web.service.ProcessService#process(Reader, Character, Character, Character, Boolean)
*/
@Override
public List<String[]> process(final Reader reader, final Character separator, final Character quoteChar, final Character escapeChar, String validateType, final Boolean toCurrentTaxa)
throws ParseException, IOException, TaxonomyException {
return run(reader, separator, quoteChar, escapeChar, toCurrentTaxa);
public List<String[]> process(final Reader reader, final Character separator, final Character quoteChar, final Character escapeChar,
String validateType, final Boolean toCurrentTaxa, Character decimalMark) throws ParseException, IOException, TaxonomyException {
return run(reader, separator, quoteChar, escapeChar, toCurrentTaxa, decimalMark);
}
private List<String[]> run(final Reader reader, final Character separator, final Character quoteChar, final Character escapeChar, final Boolean toCurrentTaxa)
throws UnsupportedEncodingException, FileNotFoundException, IOException {
private List<String[]> run(final Reader reader, final Character separator, final Character quoteChar, final Character escapeChar, final Boolean toCurrentTaxa,
final Character decimalMark) throws UnsupportedEncodingException, FileNotFoundException, IOException {
final List<String[]> lines = new LinkedList<>();
......
package org.genesys.taxonomy.checker.web.staurtap;
package org.genesys.taxonomy.checker.web.startup;
import org.genesys.taxonomy.checker.web.util.DownloaderData;
import org.slf4j.Logger;
......@@ -44,10 +44,11 @@ public class StartupInitializer implements InitializingBean{
@Override
public void afterPropertiesSet() throws Exception {
LOG.info("Start download files");
LOG.info("Start download files if needed");
downloaderData.downloadDataIfNeed(dataFolderPath, landPolygonsUrl, LAND_POLYGONS_FILE_NAME_TEMPLATE, true);
downloaderData.downloadDataIfNeed(dataFolderPath, waterPolygonsUrl, WATER_POLYGONS_FILE_NAME_TEMPLATE,true);
downloaderData.downloadDataIfNeed(dataFolderPath, worldBordersUrl, TM_WORLD_BORDERS__FILE_NAME_TEMPLATE,true);
downloaderData.downloadDataIfNeed(dataFolderPath, gadmUrl, GADM_FILE_NAME_TEMPLATE,true);
LOG.info("Downloaded all files");
}
}
......@@ -81,4 +81,8 @@ public class ApplicationUtils {
/** The Constant HEADER_LANDORSEA_CHECK. */
public static final String HEADER_LANDORSEA_CHECK = "LANDorSEA_check";
public static final String HEADER_DECLATITUDE_CHECK = "DECLATITUDE_parsed";
public static final String HEADER_DECLONGITUDE_CHECK = "DECLONGITUDE_parsed";
}
......@@ -23,6 +23,9 @@ label.non.current.taxa=Flag non-current taxa
label.yes=Yes
label.no=No
label.decimal.mark=Decimal mark
label.decimal.mark.dot=Dot (\u03C0 is approximately 3.14159)
label.decimal.mark.comma=Comma (\u03C0 is approximately 3,14159)
http-error.401=Unauthorized
http-error.200= It's ok
......
......@@ -2,105 +2,120 @@
<html>
<head>
<title><spring:message code="label.title"/></title>
<style>
html {
font-family: Tahoma;
font-size: 12px;
}
<title><spring:message code="label.title"/></title>
<style>
html {
font-family: Tahoma;
font-size: 12px;
}
label {
display: block;
margin: 1em 0 0.5em;
font-weight: bold;
}
h2 {
font-size: 14px;
}
p.hint {
margin: 0.5em;
font-style: italic;
}
h3 {
margin: 1em 0 0.5em;
font-size: 12px;
}
form textarea {
width: 100%;
height: 10em;
}
p.hint {
margin: 0.5em;
font-style: italic;
}
.btn {
padding: 1em 2em;
margin: 2em 0;
}
form textarea {
width: 100%;
height: 10em;
}
</style>
.btn {
padding: 1em 2em;
margin: 2em 0;
}
</style>
</head>
<body>
<h1>
<h1>
How to use the MCPD taxonomy validation tool?
</h1>
<p>
See this short video to learn how to use the MCPD taxonomy validation tool: <a target="_blank"
href="https://www.youtube.com/watch?v=LR9Fl1P84Gc&index=6&list=PLDlzgGuc_qUrhzC0o4Mo5Esvn8vQ0R-D5">https://www.youtube.com/watch?v=LR9Fl1P84Gc&index=6&list=PLDlzgGuc_qUrhzC0o4Mo5Esvn8vQ0R-D5</a>
</p>
<div>
<label>Source taxonomy databases</label>
</h1>