Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
validator.genesys-pgr.org
Commits
f7559171
Commit
f7559171
authored
Apr 19, 2018
by
Matija Obreza
Browse files
GUI option to download results as CSV
parent
97d90d1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys/taxonomy/checker/web/controller/ValidatorController.java
View file @
f7559171
...
...
@@ -102,6 +102,20 @@ public class ValidatorController {
return
"result"
;
}
@RequestMapping
(
value
=
"process"
,
method
=
RequestMethod
.
POST
,
params
=
{
"csvText"
,
"download"
})
public
void
processStringToCSV1
(
@RequestParam
(
name
=
"separator"
,
required
=
false
,
defaultValue
=
","
)
final
Character
separator
,
@RequestParam
(
name
=
"separatorOther"
,
required
=
false
,
defaultValue
=
""
)
final
Character
separatorOther
,
@RequestParam
(
name
=
"quoteChar"
,
required
=
false
,
defaultValue
=
"\""
)
final
Character
quoteChar
,
@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
HttpServletResponse
response
)
throws
IOException
,
ParseException
,
TaxonomyException
{
processStringToCSV
(
separator
,
separatorOther
,
quoteChar
,
escapeChar
,
csvText
,
toCurrentTaxa
,
validateType
,
decimalMark
,
response
);
}
/**
* Process string.
*
...
...
@@ -116,7 +130,7 @@ public class ValidatorController {
* @throws ParseException the parse exception
* @throws TaxonomyException the taxonomy exception
*/
@RequestMapping
(
value
=
"process"
,
method
=
RequestMethod
.
POST
,
params
=
"csvText"
,
produces
=
"text/csv"
)
@RequestMapping
(
value
=
"process"
,
method
=
RequestMethod
.
POST
,
params
=
{
"csvText"
}
,
produces
=
"text/csv"
)
public
void
processStringToCSV
(
@RequestParam
(
name
=
"separator"
,
required
=
false
,
defaultValue
=
","
)
final
Character
separator
,
@RequestParam
(
name
=
"separatorOther"
,
required
=
false
,
defaultValue
=
""
)
final
Character
separatorOther
,
@RequestParam
(
name
=
"quoteChar"
,
required
=
false
,
defaultValue
=
"\""
)
final
Character
quoteChar
,
...
...
src/main/resources/i18n/messages.properties
View file @
f7559171
...
...
@@ -20,6 +20,7 @@ label.separator.other=Other
label.quote-char
=
Quote character
hint.quote-char
=
Quote character is used to mark the start and end of a column. Commonly the double quote: "
label.other
=
Other
label.download
=
Download results as CSV
label.escape-char
=
Escape character
hint.escape-char
=
If the quote character is used in column text, it must be escaped: "This is: a
\\\"
column
\\\"
"
...
...
src/main/webapp/WEB-INF/jsp/index.jsp
View file @
f7559171
...
...
@@ -128,6 +128,13 @@
<label
for=
"toCurrentTaxaNo"
><spring:message
code=
"label.no"
/></label>
</div>
<h2>
4. Preview or Download
</h2>
<p
class=
"hint"
>
Tick the box if you want to download results as CSV file. Leave unticked to see results in the browser.
</p>
<div>
<input
type=
"checkbox"
id=
"download"
name=
"download"
value=
"1"
/>
<label
for=
"download"
><spring:message
code=
"label.download"
/></label>
</div>
<div
style=
"margin: 2em 0;"
>
<button
class=
"btn"
type=
"submit"
value=
""
name=
"validateType"
>
<spring:message
code=
"label.run-check"
/>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment