@Test public void testFetchGeography() { }
public Optional<List<Geography>> fetchGeography(String tenantId, String filter, RequestInfo requestInfo) { Optional<JSONArray> geographiesCheck; List<Geography> geographies; try { geographiesCheck = mdmsRepository.getMdmsDataByCriteria(tenantId, filter, requestInfo, BoundaryConstants.GEO_MODULE_NAME, BoundaryConstants.GEO_MASTER_NAME); } catch (HttpClientErrorException e) { throw new ServiceCallException(e.getResponseBodyAsString()); } catch (RestClientException e) { throw new CustomException(GEOGRAPHY_SEARCH_MDMS_SERVICE_UNAVAILABLE_MSG, SEARCH_MDMS_SERVICE_UNAVAILABLE_DESC); } if (geographiesCheck.isPresent()) { geographies = OBJECT_MAPPER.convertValue(geographiesCheck.get(), new TypeReference<List<Geography>> () { }); geographies.forEach(geography -> geography.setTenantId(tenantId)); return Optional.of(geographies); } else return Optional.empty(); }
MdmsService { public Optional<List<Geography>> fetchGeography(String tenantId, String filter, RequestInfo requestInfo) { Optional<JSONArray> geographiesCheck; List<Geography> geographies; try { geographiesCheck = mdmsRepository.getMdmsDataByCriteria(tenantId, filter, requestInfo, BoundaryConstants.GEO_MODULE_NAME, BoundaryConstants.GEO_MASTER_NAME); } catch (HttpClientErrorException e) { throw new ServiceCallException(e.getResponseBodyAsString()); } catch (RestClientException e) { throw new CustomException(GEOGRAPHY_SEARCH_MDMS_SERVICE_UNAVAILABLE_MSG, SEARCH_MDMS_SERVICE_UNAVAILABLE_DESC); } if (geographiesCheck.isPresent()) { geographies = OBJECT_MAPPER.convertValue(geographiesCheck.get(), new TypeReference<List<Geography>> () { }); geographies.forEach(geography -> geography.setTenantId(tenantId)); return Optional.of(geographies); } else return Optional.empty(); } }
MdmsService { public Optional<List<Geography>> fetchGeography(String tenantId, String filter, RequestInfo requestInfo) { Optional<JSONArray> geographiesCheck; List<Geography> geographies; try { geographiesCheck = mdmsRepository.getMdmsDataByCriteria(tenantId, filter, requestInfo, BoundaryConstants.GEO_MODULE_NAME, BoundaryConstants.GEO_MASTER_NAME); } catch (HttpClientErrorException e) { throw new ServiceCallException(e.getResponseBodyAsString()); } catch (RestClientException e) { throw new CustomException(GEOGRAPHY_SEARCH_MDMS_SERVICE_UNAVAILABLE_MSG, SEARCH_MDMS_SERVICE_UNAVAILABLE_DESC); } if (geographiesCheck.isPresent()) { geographies = OBJECT_MAPPER.convertValue(geographiesCheck.get(), new TypeReference<List<Geography>> () { }); geographies.forEach(geography -> geography.setTenantId(tenantId)); return Optional.of(geographies); } else return Optional.empty(); } @Autowired  MdmsService(MdmsRepository mdmsRepository); }
MdmsService { public Optional<List<Geography>> fetchGeography(String tenantId, String filter, RequestInfo requestInfo) { Optional<JSONArray> geographiesCheck; List<Geography> geographies; try { geographiesCheck = mdmsRepository.getMdmsDataByCriteria(tenantId, filter, requestInfo, BoundaryConstants.GEO_MODULE_NAME, BoundaryConstants.GEO_MASTER_NAME); } catch (HttpClientErrorException e) { throw new ServiceCallException(e.getResponseBodyAsString()); } catch (RestClientException e) { throw new CustomException(GEOGRAPHY_SEARCH_MDMS_SERVICE_UNAVAILABLE_MSG, SEARCH_MDMS_SERVICE_UNAVAILABLE_DESC); } if (geographiesCheck.isPresent()) { geographies = OBJECT_MAPPER.convertValue(geographiesCheck.get(), new TypeReference<List<Geography>> () { }); geographies.forEach(geography -> geography.setTenantId(tenantId)); return Optional.of(geographies); } else return Optional.empty(); } @Autowired  MdmsService(MdmsRepository mdmsRepository); Optional<List<Geography>> fetchGeography(String tenantId, String filter, RequestInfo requestInfo); Optional<Tenant> fetchTenant(String tenantId, String filter, RequestInfo requestInfo); }
MdmsService { public Optional<List<Geography>> fetchGeography(String tenantId, String filter, RequestInfo requestInfo) { Optional<JSONArray> geographiesCheck; List<Geography> geographies; try { geographiesCheck = mdmsRepository.getMdmsDataByCriteria(tenantId, filter, requestInfo, BoundaryConstants.GEO_MODULE_NAME, BoundaryConstants.GEO_MASTER_NAME); } catch (HttpClientErrorException e) { throw new ServiceCallException(e.getResponseBodyAsString()); } catch (RestClientException e) { throw new CustomException(GEOGRAPHY_SEARCH_MDMS_SERVICE_UNAVAILABLE_MSG, SEARCH_MDMS_SERVICE_UNAVAILABLE_DESC); } if (geographiesCheck.isPresent()) { geographies = OBJECT_MAPPER.convertValue(geographiesCheck.get(), new TypeReference<List<Geography>> () { }); geographies.forEach(geography -> geography.setTenantId(tenantId)); return Optional.of(geographies); } else return Optional.empty(); } @Autowired  MdmsService(MdmsRepository mdmsRepository); Optional<List<Geography>> fetchGeography(String tenantId, String filter, RequestInfo requestInfo); Optional<Tenant> fetchTenant(String tenantId, String filter, RequestInfo requestInfo);  }