1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.xds.core.validate;
17
18 import ca.uhn.hl7v2.model.v25.datatype.CWE;
19 import ca.uhn.hl7v2.model.v25.datatype.HD;
20
21 import static org.apache.commons.lang3.StringUtils.isEmpty;
22
23
24
25
26 public class HL7ValidationUtils {
27
28 public static boolean isEmptyField(HD hd) {
29 return isEmpty(hd.getHd1_NamespaceID().getValue()) &&
30 isEmpty(hd.getHd2_UniversalID().getValue()) &&
31 isEmpty(hd.getHd3_UniversalIDType().getValue());
32 }
33
34 public static boolean isNotEmptyField(HD hd) {
35 return !isEmptyField(hd);
36 }
37
38 public static boolean isEmptyField(CWE cwe) {
39 return isEmpty(cwe.getCwe1_Identifier().getValue()) &&
40 isEmpty(cwe.getCwe2_Text().getValue()) &&
41 isEmpty(cwe.getCwe3_NameOfCodingSystem().getValue()) &&
42 isEmpty(cwe.getCwe4_AlternateIdentifier().getValue()) &&
43 isEmpty(cwe.getCwe5_AlternateText().getValue()) &&
44 isEmpty(cwe.getCwe6_NameOfAlternateCodingSystem().getValue()) &&
45 isEmpty(cwe.getCwe7_CodingSystemVersionID().getValue()) &&
46 isEmpty(cwe.getCwe8_AlternateCodingSystemVersionID().getValue()) &&
47 isEmpty(cwe.getCwe9_OriginalText().getValue());
48 }
49
50 }