Skip to content

Commit

Permalink
[MODORSERS-1026] - Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
azizbekxm committed Apr 4, 2024
1 parent 9837b1b commit d86faff
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/main/java/org/folio/service/RoutingListService.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ private Future<TemplateProcessingRequest> getUsersAndCreateTemplate(RoutingList
.map(users -> createTemplateRequest(routingList, users, addressTypId)));
}

private Future<String> 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()
Expand Down Expand Up @@ -111,20 +125,6 @@ private String getUserAddress(List<UserCollection.User.Personal.Address> address
return "";
}

private Future<String> 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())
Expand Down

0 comments on commit d86faff

Please sign in to comment.