Skip to content

Commit

Permalink
CIV-14074 (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
drummondjm authored Jun 13, 2024
2 parents 007ace7 + d20220f commit 642118b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public enum DocumentType {
COURT_OFFICER_ORDER,
DEFENCE_TRANSLATED_DOCUMENT,
DRAFT_CLAIM_FORM,
FIXED_RECOVERABLE_COST_SUPPORTING_DOCUMENT,
//General Application Document Type
GENERAL_ORDER,
DIRECTION_ORDER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,31 @@ public LocationRefData getCcmccLocation(String authToken) {
return LocationRefData.builder().build();
}

public LocationRefData getCnbcLocation(String authToken) {
try {
ResponseEntity<List<LocationRefData>> responseEntity = restTemplate.exchange(
buildURIforCnbcSpec(),
HttpMethod.GET,
getHeaders(authToken),
new ParameterizedTypeReference<List<LocationRefData>>() {
}
);
List<LocationRefData> cnbcLocations = responseEntity.getBody();
if (cnbcLocations == null || cnbcLocations.isEmpty()) {
log.warn("Location Reference Data Lookup did not return any CNBC location");
return LocationRefData.builder().build();
} else {
if (cnbcLocations.size() > 1) {
log.warn("Location Reference Data Lookup returned more than one CNBC location");
}
return cnbcLocations.get(0);
}
} catch (Exception e) {
log.error("Location Reference Data Lookup Failed - " + e.getMessage(), e);
}
return LocationRefData.builder().build();
}

public List<LocationRefData> getCourtLocationsForDefaultJudgments(String authToken) {
try {
ResponseEntity<List<LocationRefData>> responseEntity = restTemplate.exchange(
Expand Down Expand Up @@ -140,6 +165,13 @@ private URI buildURIforCcmcc() {
return builder.buildAndExpand(new HashMap<>()).toUri();
}

private URI buildURIforCnbcSpec() {
String queryURL = lrdConfiguration.getUrl() + lrdConfiguration.getEndpoint();
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(queryURL)
.queryParam("court_venue_name", "Civil National Business Centre");
return builder.buildAndExpand(new HashMap<>()).toUri();
}

private URI buildURIForDefaultJudgments() {
String queryURL = lrdConfiguration.getUrl() + lrdConfiguration.getEndpoint();
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(queryURL)
Expand Down

0 comments on commit 642118b

Please sign in to comment.