Skip to content

Commit

Permalink
code cleanup (#481)
Browse files Browse the repository at this point in the history
hospel authored Feb 22, 2024
1 parent c910f57 commit 704e500
Showing 134 changed files with 723 additions and 729 deletions.
Original file line number Diff line number Diff line change
@@ -13,11 +13,11 @@
@Service
public class JmsReader {
public String readMessage(Message message) throws JMSException {
if (message instanceof JmsTextMessage) {
return readTextMessage((JmsTextMessage) message);
if (message instanceof JmsTextMessage jmsTextMessage) {
return readTextMessage(jmsTextMessage);
}
if (message instanceof JmsBytesMessage) {
return readBytesMessage((JmsBytesMessage) message);
if (message instanceof JmsBytesMessage jmsBytesMessage) {
return readBytesMessage(jmsBytesMessage);
}
if (message != null) {
return message.getBody(String.class);
Original file line number Diff line number Diff line change
@@ -193,10 +193,10 @@ private List<RCMRMT030101UKNarrativeStatement> getNarrativeStatementsFromCompoun
}

private void addEffective(Observation observation, Object effective) {
if (effective instanceof DateTimeType) {
observation.setEffective((DateTimeType) effective);
} else if (effective instanceof Period) {
observation.setEffective((Period) effective);
if (effective instanceof DateTimeType dateTimeType) {
observation.setEffective(dateTimeType);
} else if (effective instanceof Period period) {
observation.setEffective(period);
}
}
}
Original file line number Diff line number Diff line change
@@ -172,10 +172,10 @@ private boolean isSelfReferral(RCMRMT030101UKRequestStatement requestStatement)
}

private void addEffective(Observation observation, Object effective) {
if (effective instanceof DateTimeType) {
observation.setEffective((DateTimeType) effective);
} else if (effective instanceof Period) {
observation.setEffective((Period) effective);
if (effective instanceof DateTimeType dateTimeType) {
observation.setEffective(dateTimeType);
} else if (effective instanceof Period period) {
observation.setEffective(period);
}
}

@@ -198,8 +198,8 @@ private CodeableConcept getCode(CD code) {
}

private String getValueString(Object value) {
if (value instanceof String) {
return (String) value;
if (value instanceof String simpleValue) {
return simpleValue;
} else if (value instanceof CV cvValue) {
return cvValue.getOriginalText() != null ? cvValue.getOriginalText() : cvValue.getDisplayName();
}
Original file line number Diff line number Diff line change
@@ -158,10 +158,10 @@ private Observation createParentObservation(RCMRMT030101UKCompoundStatement comp
}

private void addEffective(Observation observation, Object effective) {
if (effective instanceof DateTimeType) {
observation.setEffective((DateTimeType) effective);
} else if (effective instanceof Period) {
observation.setEffective((Period) effective);
if (effective instanceof DateTimeType dateTimeType) {
observation.setEffective(dateTimeType);
} else if (effective instanceof Period period) {
observation.setEffective(period);
}
}

Original file line number Diff line number Diff line change
@@ -235,10 +235,10 @@ private boolean availabilityTimeHasValue(TS availabilityTime) {

private void addEffective(RCMRMT030101UKCompoundStatement compoundStatement, Observation observation) {
final Object effective = getEffective(compoundStatement.getEffectiveTime(), compoundStatement.getAvailabilityTime());
if (effective instanceof DateTimeType) {
observation.setEffective((DateTimeType) effective);
} else if (effective instanceof Period) {
observation.setEffective((Period) effective);
if (effective instanceof DateTimeType dateTimeType) {
observation.setEffective(dateTimeType);
} else if (effective instanceof Period period) {
observation.setEffective(period);
}
}

Original file line number Diff line number Diff line change
@@ -140,12 +140,10 @@ private void handleNarrativeStatements(RCMRMT030101UKCompoundStatement compoundS
}

private void createRelationship(Observation observation, Observation observationComment) {
if (observation != null) {
if (!containsRelatedComponent(observationComment, observation.getId())) {
observationComment.addRelated(new ObservationRelatedComponent(new Reference(observation))
.setType(ObservationRelationshipType.DERIVEDFROM)
);
}
if (observation != null && !containsRelatedComponent(observationComment, observation.getId())) {
observationComment.addRelated(
new ObservationRelatedComponent(new Reference(observation)).setType(ObservationRelationshipType.DERIVEDFROM)
);
}
}

Original file line number Diff line number Diff line change
@@ -246,8 +246,9 @@ private Organization getPatientOrganization(List<? extends DomainResource> agent
}

private RCMRMT030101UKEhrFolder getEhrFolder(RCMRIN030000UKMessage xmlMessage) {
if (xmlMessage instanceof RCMRIN030000UK07Message) {
return ((RCMRIN030000UK07Message) xmlMessage).getControlActEvent()
if (xmlMessage instanceof RCMRIN030000UK07Message rcmrin030000uk07message) {

return rcmrin030000uk07message.getControlActEvent()
.getSubject()
.getEhrExtract()
.getComponent()
@@ -264,8 +265,8 @@ private RCMRMT030101UKEhrFolder getEhrFolder(RCMRIN030000UKMessage xmlMessage) {
}

private RCMRMT030101UK04EhrExtract getEhrExtract(RCMRIN030000UKMessage xmlMessage) {
if (xmlMessage instanceof RCMRIN030000UK07Message) {
return ((RCMRIN030000UK07Message) xmlMessage).getControlActEvent().getSubject().getEhrExtract();
if (xmlMessage instanceof RCMRIN030000UK07Message rcmrin030000uk07message) {
return rcmrin030000uk07message.getControlActEvent().getSubject().getEhrExtract();
} else {
return ((RCMRIN030000UK06Message) xmlMessage).getControlActEvent().getSubject().getEhrExtract();
}
Original file line number Diff line number Diff line change
@@ -42,8 +42,8 @@ public class ObservationUtil {
public static Quantity getValueQuantity(Object value, CV uncertaintyCode) {
if (isValidValueQuantity(value)) {
Quantity valueQuantity;
if (value instanceof PQ) {
valueQuantity = QUANTITY_MAPPER.mapValueQuantity((PQ) value);
if (value instanceof PQ pqValue) {
valueQuantity = QUANTITY_MAPPER.mapValueQuantity(pqValue);
} else {
valueQuantity = QUANTITY_MAPPER.mapValueQuantity((IVLPQ) value);
}
Original file line number Diff line number Diff line change
@@ -86,8 +86,8 @@ public static String parseContentType(String description) throws ParseException
}

public static String parseNhsNumber(RCMRIN030000UKMessage payload) {
if (payload instanceof RCMRIN030000UK06Message) {
return ((RCMRIN030000UK06Message) payload)
if (payload instanceof RCMRIN030000UK06Message rcmrin030000uk06message) {
return rcmrin030000uk06message
.getControlActEvent()
.getSubject()
.getEhrExtract()
@@ -197,8 +197,8 @@ public static String getFromPractiseValue(Element gp2gpElement) {
}

public static String parseFromAsid(RCMRIN030000UKMessage payload) {
if (payload instanceof RCMRIN030000UK06Message) {
return ((RCMRIN030000UK06Message) payload).getCommunicationFunctionRcv()
if (payload instanceof RCMRIN030000UK06Message rcmrin030000uk06message) {
return rcmrin030000uk06message.getCommunicationFunctionRcv()
.get(0)
.getDevice()
.getId()
@@ -224,8 +224,8 @@ public static String parseToAsid(RCMRIN030000UKMessage payload) {
}

public static String parseToOdsCode(RCMRIN030000UKMessage payload) {
if (payload instanceof RCMRIN030000UK07Message) {
return ((RCMRIN030000UK07Message) payload).getControlActEvent()
if (payload instanceof RCMRIN030000UK07Message rcmrin030000uk07message) {
return rcmrin030000uk07message.getControlActEvent()
.getSubject()
.getEhrExtract()
.getAuthor()
4 changes: 2 additions & 2 deletions schema/src/main/java/org/hl7/v3/AD.java
Original file line number Diff line number Diff line change
@@ -316,7 +316,7 @@ public class AD {
*/
public List<Serializable> getContent() {
if (content == null) {
content = new ArrayList<Serializable>();
content = new ArrayList<>();
}
return this.content;
}
@@ -345,7 +345,7 @@ public List<Serializable> getContent() {
*/
public List<CsPostalAddressUse> getUse() {
if (use == null) {
use = new ArrayList<CsPostalAddressUse>();
use = new ArrayList<>();
}
return this.use;
}
8 changes: 4 additions & 4 deletions schema/src/main/java/org/hl7/v3/CD.java
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ public boolean hasOriginalText() {
*/
public List<CR> getQualifier() {
if (qualifier == null) {
qualifier = new ArrayList<CR>();
qualifier = new ArrayList<>();
}
return this.qualifier;
}
@@ -178,7 +178,7 @@ public List<CR> getQualifier() {
*/
public List<CD.Group> getGroup() {
if (group == null) {
group = new ArrayList<CD.Group>();
group = new ArrayList<>();
}
return this.group;
}
@@ -207,7 +207,7 @@ public List<CD.Group> getGroup() {
*/
public List<CD> getTranslation() {
if (translation == null) {
translation = new ArrayList<CD>();
translation = new ArrayList<>();
}
return this.translation;
}
@@ -397,7 +397,7 @@ public static class Group {
*/
public List<CR> getQualifier() {
if (qualifier == null) {
qualifier = new ArrayList<CR>();
qualifier = new ArrayList<>();
}
return this.qualifier;
}
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ public void setAuthor(MCAIMT040101UK03Author value) {
*/
public List<MCAIMT040101UK03Author2> getAuthor1() {
if (author1 == null) {
author1 = new ArrayList<MCAIMT040101UK03Author2>();
author1 = new ArrayList<>();
}
return this.author1;
}
@@ -139,7 +139,7 @@ public List<MCAIMT040101UK03Author2> getAuthor1() {
*/
public List<MCAIMT040101UK03Reason> getReason() {
if (reason == null) {
reason = new ArrayList<MCAIMT040101UK03Reason>();
reason = new ArrayList<>();
}
return this.reason;
}
@@ -240,7 +240,7 @@ public void setMoodCode(String value) {
*/
public List<String> getNullFlavor() {
if (nullFlavor == null) {
nullFlavor = new ArrayList<String>();
nullFlavor = new ArrayList<>();
}
return this.nullFlavor;
}
4 changes: 2 additions & 2 deletions schema/src/main/java/org/hl7/v3/COPCIN000001UK01Message.java
Original file line number Diff line number Diff line change
@@ -310,7 +310,7 @@ public void setAcceptAckCode(CS value) {
*/
public List<MCCIMT010101UK12CommunicationFunctionRcv> getCommunicationFunctionRcv() {
if (communicationFunctionRcv == null) {
communicationFunctionRcv = new ArrayList<MCCIMT010101UK12CommunicationFunctionRcv>();
communicationFunctionRcv = new ArrayList<>();
}
return this.communicationFunctionRcv;
}
@@ -387,7 +387,7 @@ public void setControlActEvent(COPCIN000001UK01ControlActEvent value) {
*/
public List<String> getNullFlavor() {
if (nullFlavor == null) {
nullFlavor = new ArrayList<String>();
nullFlavor = new ArrayList<>();
}
return this.nullFlavor;
}
Original file line number Diff line number Diff line change
@@ -141,7 +141,7 @@ public void setContextConductionInd(boolean value) {
*/
public List<String> getNullFlavor() {
if (nullFlavor == null) {
nullFlavor = new ArrayList<String>();
nullFlavor = new ArrayList<>();
}
return this.nullFlavor;
}
Original file line number Diff line number Diff line change
@@ -209,7 +209,7 @@ public void setMoodCode(String value) {
*/
public List<String> getNullFlavor() {
if (nullFlavor == null) {
nullFlavor = new ArrayList<String>();
nullFlavor = new ArrayList<>();
}
return this.nullFlavor;
}
Original file line number Diff line number Diff line change
@@ -188,7 +188,7 @@ public void setValue(ED value) {
*/
public List<COPCMT000001UK01PertinentInformation> getPertinentInformation() {
if (pertinentInformation == null) {
pertinentInformation = new ArrayList<COPCMT000001UK01PertinentInformation>();
pertinentInformation = new ArrayList<>();
}
return this.pertinentInformation;
}
@@ -273,7 +273,7 @@ public void setMoodCode(String value) {
*/
public List<String> getNullFlavor() {
if (nullFlavor == null) {
nullFlavor = new ArrayList<String>();
nullFlavor = new ArrayList<>();
}
return this.nullFlavor;
}
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ public void setTypeCode(String value) {
*/
public List<String> getNullFlavor() {
if (nullFlavor == null) {
nullFlavor = new ArrayList<String>();
nullFlavor = new ArrayList<>();
}
return this.nullFlavor;
}
2 changes: 1 addition & 1 deletion schema/src/main/java/org/hl7/v3/ED.java
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ public void setThumbnail(Thumbnail value) {
*/
public List<Element> getAny() {
if (any == null) {
any = new ArrayList<Element>();
any = new ArrayList<>();
}
return this.any;
}
2 changes: 1 addition & 1 deletion schema/src/main/java/org/hl7/v3/EN.java
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ public class EN {
*/
public List<CsEntityNameUse> getUse() {
if (use == null) {
use = new ArrayList<CsEntityNameUse>();
use = new ArrayList<>();
}
return this.use;
}
2 changes: 1 addition & 1 deletion schema/src/main/java/org/hl7/v3/ENXP.java
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ public void setPartType(CsEntityNamePartType value) {
*/
public List<CsEntityNamePartQualifier> getQualifier() {
if (qualifier == null) {
qualifier = new ArrayList<CsEntityNamePartQualifier>();
qualifier = new ArrayList<>();
}
return this.qualifier;
}
2 changes: 1 addition & 1 deletion schema/src/main/java/org/hl7/v3/IVLINT.java
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ public class IVLINT {
*/
public List<Serializable> getContent() {
if (content == null) {
content = new ArrayList<Serializable>();
content = new ArrayList<>();
}
return this.content;
}
2 changes: 1 addition & 1 deletion schema/src/main/java/org/hl7/v3/IVLPQ.java
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ public class IVLPQ
*/
public List<JAXBElement<?>> getRest() {
if (rest == null) {
rest = new ArrayList<JAXBElement<?>>();
rest = new ArrayList<>();
}
return this.rest;
}
8 changes: 4 additions & 4 deletions schema/src/main/java/org/hl7/v3/MCAIMT040101UK03Act.java
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ public void setType(String value) {
*/
public List<String> getClassCode() {
if (classCode == null) {
classCode = new ArrayList<String>();
classCode = new ArrayList<>();
}
return this.classCode;
}
@@ -141,7 +141,7 @@ public List<String> getClassCode() {
*/
public List<String> getMoodCode() {
if (moodCode == null) {
moodCode = new ArrayList<String>();
moodCode = new ArrayList<>();
}
return this.moodCode;
}
@@ -170,7 +170,7 @@ public List<String> getMoodCode() {
*/
public List<String> getTypeID() {
if (typeID == null) {
typeID = new ArrayList<String>();
typeID = new ArrayList<>();
}
return this.typeID;
}
@@ -199,7 +199,7 @@ public List<String> getTypeID() {
*/
public List<String> getRealmCode() {
if (realmCode == null) {
realmCode = new ArrayList<String>();
realmCode = new ArrayList<>();
}
return this.realmCode;
}
Loading

0 comments on commit 704e500

Please sign in to comment.