From 722b84d25c96064a6d9bcb8d4c813f058f7002b5 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Tue, 5 Nov 2024 12:32:36 +0100 Subject: [PATCH] [#205] Refactor: Rename rejectMessage to rejectReason --- .../cz/cvut/kbss/study/dto/PatientRecordDto.java | 12 ++++++------ .../java/cz/cvut/kbss/study/model/PatientRecord.java | 12 ++++++------ .../kbss/study/rest/PatientRecordController.java | 6 +++--- .../repository/RepositoryPatientRecordService.java | 2 +- .../java/cz/cvut/kbss/study/util/ConfigParam.java | 2 +- src/main/resources/config.properties | 2 +- src/main/resources/model.ttl | 4 ++-- .../kbss/study/rest/PatientRecordControllerTest.java | 12 ++++++------ 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java b/src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java index f5adf31..0ff51b4 100644 --- a/src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java +++ b/src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java @@ -41,8 +41,8 @@ public class PatientRecordDto extends AbstractEntity implements HasOwlKey { @OWLObjectProperty(iri = Vocabulary.s_p_has_phase) private RecordPhase phase; - @OWLDataProperty(iri = Vocabulary.s_p_has_reject_message) - private String rejectMessage; + @OWLDataProperty(iri = Vocabulary.s_p_reject_reason) + private String rejectReason; @Override @@ -119,12 +119,12 @@ public void setPhase(RecordPhase phase) { this.phase = phase; } - public String getRejectMessage() { - return rejectMessage; + public String getRejectReason() { + return rejectReason; } - public void setRejectMessage(String rejectMessage) { - this.rejectMessage = rejectMessage; + public void setRejectReason(String rejectReason) { + this.rejectReason = rejectReason; } @Override diff --git a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java index 43925db..84cec45 100644 --- a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java +++ b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java @@ -59,8 +59,8 @@ public class PatientRecord implements Serializable, HasOwlKey, HasUri { @OWLObjectProperty(iri = Vocabulary.s_p_has_phase, cascade = {CascadeType.MERGE}, fetch = FetchType.EAGER) private RecordPhase phase; - @OWLDataProperty(iri = Vocabulary.s_p_has_reject_message) - private String rejectMessage; + @OWLDataProperty(iri = Vocabulary.s_p_reject_reason) + private String rejectReason; @Override public URI getUri() { @@ -149,12 +149,12 @@ public RecordPhase getPhase() { return phase; } - public String getRejectMessage() { - return rejectMessage; + public String getRejectReason() { + return rejectReason; } - public void setRejectMessage(String rejectMessage) { - this.rejectMessage = rejectMessage; + public void setRejectReason(String rejectReason) { + this.rejectReason = rejectReason; } 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 610eb52..aac3167 100644 --- a/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java +++ b/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java @@ -355,8 +355,8 @@ public void removeRecord(@PathVariable("key") String key) { } } - @GetMapping(value = "/allowedRejectMessage", produces = MediaType.APPLICATION_JSON_VALUE) - public boolean getAllowedRejectMessage(){ - return configReader.getConfig(ConfigParam.RECORDS_ALLOWED_REJECT_MESSAGE).equals("true"); + @GetMapping(value = "/allowedRejectReason", produces = MediaType.APPLICATION_JSON_VALUE) + public boolean getAllowedRejectReason(){ + return configReader.getConfig(ConfigParam.RECORDS_ALLOWED_REJECT_REASON).equals("true"); } } diff --git a/src/main/java/cz/cvut/kbss/study/service/repository/RepositoryPatientRecordService.java b/src/main/java/cz/cvut/kbss/study/service/repository/RepositoryPatientRecordService.java index bb30ada..69fa886 100644 --- a/src/main/java/cz/cvut/kbss/study/service/repository/RepositoryPatientRecordService.java +++ b/src/main/java/cz/cvut/kbss/study/service/repository/RepositoryPatientRecordService.java @@ -74,7 +74,7 @@ protected void prePersist(PatientRecord instance) { @Override protected void preUpdate(PatientRecord instance) { if(instance.getPhase() != RecordPhase.rejected) { - instance.setRejectMessage(null); + instance.setRejectReason(null); } instance.setLastModifiedBy(securityUtils.getCurrentUser()); instance.setLastModified(new Date()); 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 1b75c55..818bc1c 100644 --- a/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java +++ b/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java @@ -43,7 +43,7 @@ public enum ConfigParam { CORS_ALLOWED_ORIGINS("cors.allowedOrigins"), - RECORDS_ALLOWED_REJECT_MESSAGE("records.allowedRejectMessage"); + RECORDS_ALLOWED_REJECT_REASON("records.allowedRejectReason"); private final String name; diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties index c5f1375..68ec6da 100644 --- a/src/main/resources/config.properties +++ b/src/main/resources/config.properties @@ -63,4 +63,4 @@ oidc.roleClaim=realm_access.roles # Configures allowed origins for CORS (e.g. http://localhost:3000). Use a comma to separate multiple values cors.allowedOrigins= -records.allowedRejectMessage=true \ No newline at end of file +records.allowedRejectReason=true \ No newline at end of file diff --git a/src/main/resources/model.ttl b/src/main/resources/model.ttl index 3526111..379c2e7 100644 --- a/src/main/resources/model.ttl +++ b/src/main/resources/model.ttl @@ -132,8 +132,8 @@ rm:token rdf:type owl:DatatypeProperty . rdf:type owl:DatatypeProperty . -### http://onto.fel.cvut.cz/ontologies/record-manager/has-reject-message -rm:has-reject-message rdf:type owl:DatatypeProperty . +### http://onto.fel.cvut.cz/ontologies/record-manager/reject-reason +rm:reject-reason rdf:type owl:DatatypeProperty . ################################################################# # Classes diff --git a/src/test/java/cz/cvut/kbss/study/rest/PatientRecordControllerTest.java b/src/test/java/cz/cvut/kbss/study/rest/PatientRecordControllerTest.java index 138ba96..0917640 100644 --- a/src/test/java/cz/cvut/kbss/study/rest/PatientRecordControllerTest.java +++ b/src/test/java/cz/cvut/kbss/study/rest/PatientRecordControllerTest.java @@ -494,10 +494,10 @@ void exportRecordsPublishesPagingEvent() throws Exception { } @Test - void getAllowedRejectMessageTrue() throws Exception { + void getAllowedRejectReasonTrue() throws Exception { String expectedValue = "true"; - when(configReaderMock.getConfig(ConfigParam.RECORDS_ALLOWED_REJECT_MESSAGE)).thenReturn(expectedValue); - final MvcResult result = mockMvc.perform(get("/records/allowedRejectMessage").param("institution", user.getInstitution().toString())).andReturn(); + when(configReaderMock.getConfig(ConfigParam.RECORDS_ALLOWED_REJECT_REASON)).thenReturn(expectedValue); + final MvcResult result = mockMvc.perform(get("/records/allowedRejectReason").param("institution", user.getInstitution().toString())).andReturn(); final String body = objectMapper.readValue(result.getResponse().getContentAsString(), new TypeReference<>() { @@ -507,10 +507,10 @@ void getAllowedRejectMessageTrue() throws Exception { } @Test - void getAllowedRejectMessageFalse() throws Exception { + void getAllowedRejectReasonFalse() throws Exception { String expectedValue = "false"; - when(configReaderMock.getConfig(ConfigParam.RECORDS_ALLOWED_REJECT_MESSAGE)).thenReturn(expectedValue); - final MvcResult result = mockMvc.perform(get("/records/allowedRejectMessage").param("institution", user.getInstitution().toString())).andReturn(); + when(configReaderMock.getConfig(ConfigParam.RECORDS_ALLOWED_REJECT_REASON)).thenReturn(expectedValue); + final MvcResult result = mockMvc.perform(get("/records/allowedRejectReason").param("institution", user.getInstitution().toString())).andReturn(); final String body = objectMapper.readValue(result.getResponse().getContentAsString(), new TypeReference<>() {