diff --git a/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java b/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java index f29138fb..e3aaccf3 100644 --- a/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java +++ b/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java @@ -171,6 +171,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}") diff --git a/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java b/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java index 9a9c3360..9cb58769 100644 --- a/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java +++ b/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java @@ -9,6 +9,8 @@ public enum ConfigParam { FORM_GEN_REPOSITORY_URL("formGenRepositoryUrl"), FORM_GEN_SERVICE_URL("formGenServiceUrl"), + ON_UPDATE_RECORD_SERVICE_URL("onRecordUpdateServiceUrl"), + APP_CONTEXT("appContext"), SMTP_HOST("smtp.host"),