Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit eece8a8

Browse files
SORMAS-Foundation#3675 - Fixed name sorting, fixed wrong one- and two-digit UNO codes
1 parent ee9b425 commit eece8a8

4 files changed

Lines changed: 44 additions & 41 deletions

File tree

sormas-backend/src/main/java/de/symeda/sormas/backend/region/CountryFacadeEjb.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ public CountryDto getCountryByUuid(String uuid) {
5454

5555
@Override
5656
public List<CountryReferenceDto> getByDefaultName(String name, boolean includeArchivedEntities) {
57-
return countryService.getByDefaultName(name, includeArchivedEntities).stream().map(CountryFacadeEjb::toReferenceDto).collect(Collectors.toList());
57+
return countryService.getByDefaultName(name, includeArchivedEntities)
58+
.stream()
59+
.map(CountryFacadeEjb::toReferenceDto)
60+
.collect(Collectors.toList());
5861
}
5962

6063
@Override
@@ -74,10 +77,12 @@ public List<CountryIndexDto> getIndexList(CountryCriteria criteria, Integer firs
7477
for (SortProperty sortProperty : sortProperties) {
7578
Expression<?> expression;
7679
switch (sortProperty.propertyName) {
77-
case Country.DEFAULT_NAME:
78-
case Country.EXTERNAL_ID:
79-
case Country.ISO_CODE:
80-
case Country.UNO_CODE:
80+
case CountryIndexDto.DISPLAY_NAME:
81+
expression = country.get(Country.DEFAULT_NAME);
82+
break;
83+
case CountryIndexDto.EXTERNAL_ID:
84+
case CountryIndexDto.ISO_CODE:
85+
case CountryIndexDto.UNO_CODE:
8186
expression = country.get(sortProperty.propertyName);
8287
break;
8388
default:

sormas-backend/src/main/resources/sormas_import_all_countries.csv

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
## All WHO countries
22
"defaultName","externalId","isoCode","unoCode","archived"
3-
"Afghanistan","8501","AFG","4","FALSE"
4-
"Albania","8201","ALB","8","FALSE"
5-
"Algeria","8304","DZA","12","FALSE"
6-
"Andorra","8202","AND","20","FALSE"
7-
"Angola","8305","AGO","24","FALSE"
8-
"Antigua and Barbuda","8442","ATG","28","FALSE"
9-
"Argentina","8401","ARG","32","FALSE"
10-
"Armenia","8560","ARM","51","FALSE"
11-
"Australia","8601","AUS","36","FALSE"
12-
"Austria","8229","AUT","40","FALSE"
13-
"Azerbaijan","8561","AZE","31","FALSE"
14-
"Bahamas","8402","BHS","44","FALSE"
15-
"Bahrain","8502","BHR","48","FALSE"
16-
"Bangladesh","8546","BGD","50","FALSE"
17-
"Barbados","8403","BRB","52","FALSE"
3+
"Afghanistan","8501","AFG","004","FALSE"
4+
"Albania","8201","ALB","008","FALSE"
5+
"Algeria","8304","DZA","012","FALSE"
6+
"Andorra","8202","AND","020","FALSE"
7+
"Angola","8305","AGO","024","FALSE"
8+
"Antigua and Barbuda","8442","ATG","028","FALSE"
9+
"Argentina","8401","ARG","032","FALSE"
10+
"Armenia","8560","ARM","051","FALSE"
11+
"Australia","8601","AUS","036","FALSE"
12+
"Austria","8229","AUT","040","FALSE"
13+
"Azerbaijan","8561","AZE","031","FALSE"
14+
"Bahamas","8402","BHS","044","FALSE"
15+
"Bahrain","8502","BHR","048","FALSE"
16+
"Bangladesh","8546","BGD","050","FALSE"
17+
"Barbados","8403","BRB","052","FALSE"
1818
"Belarus","8266","BLR","112","FALSE"
19-
"Belgium","8204","BEL","56","FALSE"
20-
"Belize","8419","BLZ","84","FALSE"
19+
"Belgium","8204","BEL","056","FALSE"
20+
"Belize","8419","BLZ","084","FALSE"
2121
"Benin","8309","BEN","204","FALSE"
22-
"Bhutan","8503","BTN","64","FALSE"
23-
"Bolivia (Plurinational State of)","8405","BOL","68","FALSE"
24-
"Bosnia and Herzegovina","8252","BIH","70","FALSE"
25-
"Botswana","8307","BWA","72","FALSE"
26-
"Brazil","8406","BRA","76","FALSE"
27-
"Brunei Darussalam","8504","BRN","96","FALSE"
22+
"Bhutan","8503","BTN","064","FALSE"
23+
"Bolivia (Plurinational State of)","8405","BOL","068","FALSE"
24+
"Bosnia and Herzegovina","8252","BIH","070","FALSE"
25+
"Botswana","8307","BWA","072","FALSE"
26+
"Brazil","8406","BRA","076","FALSE"
27+
"Brunei Darussalam","8504","BRN","096","FALSE"
2828
"Bulgaria","8205","BGR","100","FALSE"
2929
"Burkina Faso","8337","BFA","854","FALSE"
3030
"Burundi","8308","BDI","108","FALSE"
@@ -162,7 +162,7 @@
162162
"Singapore","8537","SGP","702","FALSE"
163163
"Slovakia","8243","SVK","703","FALSE"
164164
"Slovenia","8251","SVN","705","FALSE"
165-
"Solomon Islands","8614","SLB","90","FALSE"
165+
"Solomon Islands","8614","SLB","090","FALSE"
166166
"Somalia","8348","SOM","706","FALSE"
167167
"South Africa","8349","ZAF","710","FALSE"
168168
"South Sudan","8363","SSD","728","FALSE"

sormas-ui/src/main/java/de/symeda/sormas/ui/configuration/infrastructure/CountriesView.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class CountriesView extends AbstractConfigurationView {
5656
private CountriesGrid grid;
5757
protected Button createButton;
5858
protected Button importButton;
59-
protected Button importAllButton;
59+
protected Button importDefaultCountriesButton;
6060
private MenuBar bulkOperationsDropdown;
6161

6262
public CountriesView() {
@@ -86,12 +86,12 @@ public CountriesView() {
8686
}, ValoTheme.BUTTON_PRIMARY);
8787
addHeaderComponent(importButton);
8888

89-
importAllButton = ButtonHelper.createIconButton(Captions.actionImportAllCountries, VaadinIcons.UPLOAD, e -> {
90-
Window window = VaadinUiUtil.showPopupWindow(new ImportAllCountriesLayout());
89+
importDefaultCountriesButton = ButtonHelper.createIconButton(Captions.actionImportAllCountries, VaadinIcons.UPLOAD, e -> {
90+
Window window = VaadinUiUtil.showPopupWindow(new ImportDefaultCountriesLayout());
9191
window.setCaption(I18nProperties.getString(Strings.headingImportAllCountries));
9292
window.addCloseListener(c -> grid.reload());
9393
}, ValoTheme.BUTTON_PRIMARY);
94-
addHeaderComponent(importAllButton);
94+
addHeaderComponent(importDefaultCountriesButton);
9595
}
9696

9797
if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_EXPORT)) {

sormas-ui/src/main/java/de/symeda/sormas/ui/configuration/infrastructure/ImportAllCountriesLayout.java renamed to sormas-ui/src/main/java/de/symeda/sormas/ui/configuration/infrastructure/ImportDefaultCountriesLayout.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,17 @@
1414
import de.symeda.sormas.api.i18n.Captions;
1515
import de.symeda.sormas.api.i18n.I18nProperties;
1616
import de.symeda.sormas.api.i18n.Strings;
17-
import de.symeda.sormas.api.infrastructure.InfrastructureType;
1817
import de.symeda.sormas.ui.caze.importer.CountryImporter;
1918
import de.symeda.sormas.ui.importer.AbstractImportLayout;
20-
import de.symeda.sormas.ui.importer.DataImporter;
2119
import de.symeda.sormas.ui.importer.ImportLayoutComponent;
22-
import de.symeda.sormas.ui.importer.InfrastructureImporter;
2320

2421
@SuppressWarnings("serial")
25-
public class ImportAllCountriesLayout extends AbstractImportLayout {
22+
public class ImportDefaultCountriesLayout extends AbstractImportLayout {
2623

27-
public ImportAllCountriesLayout() {
24+
public ImportDefaultCountriesLayout() {
2825
super();
2926

30-
addImportAllCountriesCsvComponent(1, (event) -> {
27+
addImportDefaultCountriesCsvComponent(1, (event) -> {
3128
URI countriesFileUri = FacadeProvider.getImportFacade().getAllCountriesImportFilePath();
3229
File countriesFile = Paths.get(countriesFileUri).toFile();
3330
resetDownloadErrorReportButton();
@@ -47,10 +44,11 @@ public ImportAllCountriesLayout() {
4744
addDownloadErrorReportComponent(2);
4845
}
4946

50-
protected void addImportAllCountriesCsvComponent(int step, Button.ClickListener clickListener) {
47+
protected void addImportDefaultCountriesCsvComponent(int step, Button.ClickListener clickListener) {
5148
String headline = I18nProperties.getString(Strings.headingImportAllCountries);
5249
String infoText = I18nProperties.getString(Strings.infoImportAllCountries);
53-
ImportLayoutComponent importCsvComponent = new ImportLayoutComponent(step, headline, infoText, null, I18nProperties.getCaption(Captions.actionImport));
50+
ImportLayoutComponent importCsvComponent =
51+
new ImportLayoutComponent(step, headline, infoText, null, I18nProperties.getCaption(Captions.actionImport));
5452
importCsvComponent.getButton().addClickListener(clickListener);
5553
addComponent(importCsvComponent);
5654
}

0 commit comments

Comments
 (0)