Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit c1b304e

Browse files
committed
add additional null checks
1 parent 572d8b2 commit c1b304e

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

  • codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/ReadData.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,13 @@ else if (resource instanceof Condition)
255255
if (c.hasRecordedDateElement() && c.getRecordedDateElement().getValueAsString() != null)
256256
updateUrl = updateUrl + "&recorded-date=" + c.getRecordedDateElement().getValueAsString();
257257

258-
if (c.hasCategory())
258+
if (c.hasCategory() && c.getCategoryFirstRep().hasCoding())
259259
updateUrl = updateUrl + "&category=" + getCodingUpdateUrl(c.getCategoryFirstRep().getCodingFirstRep());
260260

261-
if (c.hasCode())
261+
if (c.hasCode() && c.getCode().hasCoding())
262262
updateUrl = updateUrl + "&code=" + getCodingUpdateUrl(c.getCode().getCodingFirstRep());
263263

264-
if (c.hasBodySite())
264+
if (c.hasBodySite() && c.getBodySiteFirstRep().hasCoding())
265265
updateUrl = updateUrl + "&body-site=" + getCodingUpdateUrl(c.getBodySiteFirstRep().getCodingFirstRep());
266266

267267
return updateUrl;
@@ -305,10 +305,10 @@ else if (resource instanceof DiagnosticReport)
305305
if (dr.hasEffectiveDateTimeType() && dr.getEffectiveDateTimeType().getValueAsString() != null)
306306
updateUrl = updateUrl + "&date=" + dr.getEffectiveDateTimeType().getValueAsString();
307307

308-
if (dr.hasCategory())
308+
if (dr.hasCategory() && dr.getCategoryFirstRep().hasCoding())
309309
updateUrl = updateUrl + "&category=" + getCodingUpdateUrl(dr.getCategoryFirstRep().getCodingFirstRep());
310310

311-
if (dr.hasCode())
311+
if (dr.hasCode() && dr.getCode().hasCoding())
312312
updateUrl = updateUrl + "&code=" + getCodingUpdateUrl(dr.getCode().getCodingFirstRep());
313313

314314
return updateUrl;
@@ -326,7 +326,7 @@ else if (resource instanceof Immunization)
326326
else if (i.hasStatus())
327327
updateUrl = updateUrl + "&status=" + i.getStatus().toCode();
328328

329-
if (i.hasVaccineCode())
329+
if (i.hasVaccineCode() && i.getVaccineCode().hasCoding())
330330
updateUrl = updateUrl + "&vaccine-code=" + i.getVaccineCode().getCodingFirstRep();
331331

332332
return updateUrl;
@@ -341,11 +341,10 @@ else if (resource instanceof MedicationStatement)
341341

342342
if (ms.hasEffectiveDateTimeType() && ms.getEffectiveDateTimeType().getValueAsString() != null)
343343
updateUrl = updateUrl + "&effective=" + ms.getEffectiveDateTimeType();
344-
345-
if (!ms.hasEffectiveDateTimeType() && ms.hasStatus())
344+
else if (ms.hasStatus())
346345
updateUrl = updateUrl + "&status=" + ms.getStatus().toCode();
347346

348-
if (ms.hasMedicationCodeableConcept())
347+
if (ms.hasMedicationCodeableConcept() && ms.getMedicationCodeableConcept().hasCoding())
349348
updateUrl = updateUrl + "&code="
350349
+ getCodingUpdateUrl(ms.getMedicationCodeableConcept().getCodingFirstRep());
351350

@@ -363,10 +362,10 @@ else if (resource instanceof Observation)
363362
if (o.hasEffectiveDateTimeType() && o.getEffectiveDateTimeType().getValueAsString() != null)
364363
updateUrl = updateUrl + "&date=" + o.getEffectiveDateTimeType().getValueAsString();
365364

366-
if (o.hasCategory())
365+
if (o.hasCategory() && o.getCategoryFirstRep().hasCoding())
367366
updateUrl = updateUrl + "&category=" + getCodingUpdateUrl(o.getCategoryFirstRep().getCodingFirstRep());
368367

369-
if (o.hasCode())
368+
if (o.hasCode() && o.getCode().hasCoding())
370369
updateUrl = updateUrl + "&code=" + getCodingUpdateUrl(o.getCode().getCodingFirstRep());
371370

372371
return updateUrl;
@@ -384,10 +383,10 @@ else if (resource instanceof Procedure)
384383
else if (p.hasStatus())
385384
updateUrl = updateUrl + "&status=" + p.getStatus().toCode();
386385

387-
if (p.hasCategory())
386+
if (p.hasCategory() && p.getCategory().hasCoding())
388387
updateUrl = updateUrl + "&category=" + getCodingUpdateUrl(p.getCategory().getCodingFirstRep());
389388

390-
if (p.hasCode())
389+
if (p.hasCode() && p.getCode().hasCoding())
391390
updateUrl = updateUrl + "&code=" + getCodingUpdateUrl(p.getCode().getCodingFirstRep());
392391

393392
return updateUrl;

0 commit comments

Comments
 (0)