Skip to content

Commit

Permalink
[#205] Refactor: Rename rejectMessage to rejectReason
Browse files Browse the repository at this point in the history
  • Loading branch information
palagdan authored and blcham committed Nov 6, 2024
1 parent fadeaab commit 722b84d
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/cz/cvut/kbss/study/model/PatientRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cz/cvut/kbss/study/util/ConfigParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
records.allowedRejectReason=true
4 changes: 2 additions & 2 deletions src/main/resources/model.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ rm:token rdf:type owl:DatatypeProperty .
<http://xmlns.com/foaf/0.1/mbox> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>() {
Expand All @@ -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<>() {
Expand Down

0 comments on commit 722b84d

Please sign in to comment.