Skip to content

Commit

Permalink
[Fix partially kbss-cvut/record-manager-ui#182] Call onRecordUpdateSe…
Browse files Browse the repository at this point in the history
…rviceUrl if configured when record is updated.
  • Loading branch information
kostobog committed Jul 11, 2024
1 parent f57d68e commit 66f5b96
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,23 @@ public void updateRecord(@PathVariable("key") String key, @RequestBody PatientRe
if (LOG.isTraceEnabled()) {
LOG.trace("Patient record {} successfully updated.", record);
}

onUpdateRecord(record.getUri());
}

private void onUpdateRecord(URI uri){
Objects.nonNull(uri);
String onRecordUpdateServiceUrl = configReader.getConfig(ConfigParam.ON_UPDATE_RECORD_SERVICE_URL);
if(onRecordUpdateServiceUrl == null || onRecordUpdateServiceUrl.isBlank()) {
LOG.debug("No onRecordUpdateServiceUrl service url provided, noop.");
return;
}

LOG.debug("calling onRecordUpdateServiceUrl: {} with parameter {}", onRecordUpdateServiceUrl, uri);
String requestUrl = UriComponentsBuilder.fromHttpUrl(onRecordUpdateServiceUrl)
.queryParam("record", uri)
.toUriString();
restTemplate.getForObject(requestUrl,String.class);
}

@DeleteMapping(value = "/{key}")
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cz/cvut/kbss/study/util/ConfigParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public enum ConfigParam {
FORM_GEN_SERVICE_URL("formGenServiceUrl"),

PUBLISH_SERVICE_URL("publishServiceUrl"),
ON_UPDATE_RECORD_SERVICE_URL("onRecordUpdateServiceUrl"),

APP_CONTEXT("appContext"),

Expand Down

0 comments on commit 66f5b96

Please sign in to comment.