From d86faff13ad9e6922760f31381f59a98c76e46b0 Mon Sep 17 00:00:00 2001 From: Azizbek Khushvakov Date: Thu, 4 Apr 2024 17:41:37 +0500 Subject: [PATCH] [MODORSERS-1026] - Reformat code --- .../org/folio/service/RoutingListService.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/folio/service/RoutingListService.java b/src/main/java/org/folio/service/RoutingListService.java index 08c189c3e..8c9b92b9e 100644 --- a/src/main/java/org/folio/service/RoutingListService.java +++ b/src/main/java/org/folio/service/RoutingListService.java @@ -62,6 +62,20 @@ private Future getUsersAndCreateTemplate(RoutingList .map(users -> createTemplateRequest(routingList, users, addressTypId))); } + private Future getAddressTypeId(RequestContext requestContext) { + var requestEntry = new RequestEntry(ORDER_SETTINGS_ENDPOINT) + .withQuery("key=" + ROUTING_USER_ADDRESS_TYPE_ID); + return restClient.get(requestEntry, SettingCollection.class, requestContext) + .map(settingCollection -> { + var settings = settingCollection.getSettings(); + if (ObjectUtils.isEmpty(settings) || StringUtils.isBlank(settings.get(0).getValue())) { + log.error("getAddressTypeId:: Setting is not found with key={}", ROUTING_USER_ADDRESS_TYPE_ID); + throw new ResourceNotFoundException(String.format("Setting is not found with key=%s", ROUTING_USER_ADDRESS_TYPE_ID)); + } + return settings.get(0).getValue(); + }); + } + private TemplateProcessingRequest createTemplateRequest(RoutingList routingList, UserCollection users, String addressTypeId) { var templateRequest = createBaseTemplateRequest(); templateRequest.withContext(new TemplateProcessingRequest.Context() @@ -111,20 +125,6 @@ private String getUserAddress(List address return ""; } - private Future getAddressTypeId(RequestContext requestContext) { - var requestEntry = new RequestEntry(ORDER_SETTINGS_ENDPOINT) - .withQuery("key=" + ROUTING_USER_ADDRESS_TYPE_ID); - return restClient.get(requestEntry, SettingCollection.class, requestContext) - .map(settingCollection -> { - var settings = settingCollection.getSettings(); - if (ObjectUtils.isEmpty(settings) || StringUtils.isBlank(settings.get(0).getValue())) { - log.error("getAddressTypeId:: Setting is not found with key={}", ROUTING_USER_ADDRESS_TYPE_ID); - throw new ResourceNotFoundException(String.format("Setting is not found with key=%s", ROUTING_USER_ADDRESS_TYPE_ID)); - } - return settings.get(0).getValue(); - }); - } - private RoutingList fillRoutingListForContext(RoutingList routingList) { return new RoutingList() .withName(routingList.getName())