Skip to content

Commit adad877

Browse files
committed
MODFQMMGR-746 Switch from mod-config to mod-settings for locale
1 parent ada483b commit adad877

7 files changed

Lines changed: 28 additions & 324 deletions

File tree

src/main/java/org/folio/fqm/repository/DataRefreshRepository.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ public class DataRefreshRepository {
3131
public static final Field<Double> EXCHANGE_RATE_FIELD = field("exchange_rate", Double.class);
3232
public static final String EXCHANGE_RATE_TABLE = "currency_exchange_rates";
3333
private static final String GET_EXCHANGE_RATE_PATH = "finance/exchange-rate";
34-
private static final String GET_LOCALE_SETTINGS_PATH = "configurations/entries";
35-
private static final Map<String, String> GET_LOCALE_SETTINGS_PARAMS = Map.of(
36-
"query", "(module==ORG and configName==localeSettings)"
37-
);
34+
private static final String GET_LOCALE_SETTINGS_PATH = "locale";
3835

3936
private static final List<String> SYSTEM_SUPPORTED_CURRENCIES = List.of(
4037
"USD",
@@ -120,16 +117,12 @@ public boolean refreshExchangeRates(String tenantId) {
120117
private String getSystemCurrencyCode() {
121118
log.info("Getting system currency");
122119
try {
123-
String localeSettingsResponse = simpleHttpClient.get(GET_LOCALE_SETTINGS_PATH, GET_LOCALE_SETTINGS_PARAMS);
120+
String localeSettingsResponse = simpleHttpClient.get(GET_LOCALE_SETTINGS_PATH, Map.of());
124121
ObjectMapper objectMapper = new ObjectMapper();
125122
JsonNode localeSettingsNode = objectMapper.readTree(localeSettingsResponse);
126-
String valueString = localeSettingsNode
127-
.path("configs")
128-
.get(0)
129-
.path("value")
123+
return localeSettingsNode
124+
.path("currency")
130125
.asText();
131-
JsonNode valueNode = objectMapper.readTree(valueString);
132-
return valueNode.path("currency").asText();
133126
} catch (Exception e) {
134127
log.info("No system currency defined, defaulting to USD");
135128
return "USD";

src/main/java/org/folio/fqm/service/EntityTypeService.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ public class EntityTypeService {
7878

7979
private static final int COLUMN_VALUE_DEFAULT_PAGE_SIZE = 1000;
8080
private static final String LANGUAGES_FILEPATH = "languages.json5";
81-
private static final String GET_LOCALE_SETTINGS_PATH = "configurations/entries";
82-
private static final Map<String, String> GET_LOCALE_SETTINGS_PARAMS = Map.of(
83-
"query", "(module==ORG and configName==localeSettings)"
84-
);
81+
private static final String GET_LOCALE_SETTINGS_PATH = "locale";
8582
private static final List<String> EXCLUDED_CURRENCY_CODES = List.of(
8683
"XUA", "AYM", "AFA", "ADP", "ATS", "AZM", "BYB", "BYR", "BEF", "BOV", "BGL", "CLF", "COU", "CUC", "CYP", "NLG", "EEK", "XBA", "XBB",
8784
"XBC", "XBD", "FIM", "FRF", "XFO", "XFU", "GHC", "DEM", "XAU", "GRD", "GWP", "IEP", "ITL", "LVL", "LTL", "LUF", "MGF", "MTL", "MRO", "MXV",
@@ -395,16 +392,10 @@ private ColumnValues getLanguages(String searchText, List<String> tenantsToQuery
395392

396393
Locale folioLocale;
397394
try {
398-
String localeSettingsResponse = simpleHttpClient.get(GET_LOCALE_SETTINGS_PATH, GET_LOCALE_SETTINGS_PARAMS);
395+
String localeSettingsResponse = simpleHttpClient.get(GET_LOCALE_SETTINGS_PATH, Map.of());
399396
ObjectMapper objectMapper = new ObjectMapper();
400397
JsonNode localeSettingsNode = objectMapper.readTree(localeSettingsResponse);
401-
String valueString = localeSettingsNode
402-
.path("configs")
403-
.get(0)
404-
.path("value")
405-
.asText();
406-
JsonNode valueNode = objectMapper.readTree(valueString);
407-
String localeString = valueNode.path("locale").asText();
398+
String localeString = localeSettingsNode.path("locale").asText();
408399
folioLocale = new Locale(localeString.substring(0, 2)); // Java locales are in form xx, FOLIO stores locales as xx-YY
409400
} catch (Exception e) {
410401
log.debug("No default locale defined. Defaulting to English for language translations.");

src/main/resources/entity-types/configuration/simple_config_data.json5

Lines changed: 0 additions & 222 deletions
This file was deleted.

src/main/resources/entity-types/orders/composite_po_instance.json5

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
id: '7a14b9b7-701b-4f81-bdb3-c4dee4121fdf',
33
name: 'composite_po_instance',
44
private: false,
5-
requiredPermissions: [
6-
// This inherited from simple_config_data, but is also included here because of the added columns here that also retrieve config data
7-
'configuration.entries.collection.get',
8-
],
95
sources: [
106
{
117
alias: 'pol',

src/main/resources/entity-types/orders/simple_purchase_order.json5

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,6 @@
112112
queryable: true,
113113
visibleByDefault: false,
114114
valueGetter: ":sourceAlias.jsonb->>'billTo'",
115-
joinsTo: [
116-
{
117-
targetId: 'abb28bac-e090-48c1-a48b-3fe805638041',
118-
targetField: 'id',
119-
type: 'equality-cast-uuid',
120-
direction: 'left',
121-
},
122-
],
123115
},
124116
{
125117
name: 'close_reason',
@@ -298,14 +290,6 @@
298290
queryable: true,
299291
visibleByDefault: false,
300292
valueGetter: ":sourceAlias.jsonb->>'shipTo'",
301-
joinsTo: [
302-
{
303-
targetId: 'abb28bac-e090-48c1-a48b-3fe805638041',
304-
targetField: 'id',
305-
type: 'equality-cast-uuid',
306-
direction: 'left',
307-
},
308-
],
309293
},
310294
{
311295
name: 'template',

0 commit comments

Comments
 (0)