Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
ba6fe73e
Commit
ba6fe73e
authored
Jun 19, 2014
by
Matija Obreza
Browse files
Use the new FAO WIEWS export_c.zip with ISO country code
parent
99269891
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/service/worker/InstituteUpdater.java
View file @
ba6fe73e
...
...
@@ -49,7 +49,7 @@ import au.com.bytecode.opencsv.CSVReader;
@Component
public
class
InstituteUpdater
{
public
static
final
String
WIEWS_EXPORT_URL
=
"http://apps3.fao.org/wiews/export.zip"
;
public
static
final
String
WIEWS_EXPORT_URL
=
"http://apps3.fao.org/wiews/export
_c
.zip"
;
public
static
final
Log
LOG
=
LogFactory
.
getLog
(
InstituteUpdater
.
class
);
...
...
@@ -98,9 +98,9 @@ public class InstituteUpdater {
instream
=
new
ZipInputStream
(
entity
.
getContent
());
final
ZipEntry
zipEntry
=
instream
.
getNextEntry
();
LOG
.
debug
(
"Got entry: "
+
zipEntry
.
getName
());
if
(!
zipEntry
.
getName
().
equals
(
"export.txt"
))
{
LOG
.
warn
(
"Expected export
.txt
, not "
+
zipEntry
.
getName
());
throw
new
IOException
(
"Missing export
.txt
"
);
if
(!
zipEntry
.
getName
().
equals
(
"export
_c
.txt"
))
{
LOG
.
warn
(
"Expected export
_c
, not "
+
zipEntry
.
getName
());
throw
new
IOException
(
"Missing export
_c
"
);
}
final
InputStreamReader
inreader
=
new
InputStreamReader
(
instream
,
"UTF-8"
);
...
...
@@ -219,6 +219,7 @@ public class InstituteUpdater {
// final String updatedOn = line[17];
// V_INSTCODE === New instcode?
final
String
vInstCode
=
line
[
18
];
final
String
isoCountry
=
line
[
19
];
if
(
faoInstitute
.
getCode
()
==
null
)
{
faoInstitute
.
setCode
(
instCode
);
...
...
@@ -242,7 +243,7 @@ public class InstituteUpdater {
// Update institute country if null or when not matching the
// code
faoInstitute
.
setCountry
(
geoService
.
getCurrentCountry
(
faoInstitute
.
getCode
().
substring
(
0
,
3
)
));
faoInstitute
.
setCountry
(
geoService
.
getCurrentCountry
(
isoCountry
));
return
true
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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