Add check for multiple WG extensions
This commit is contained in:
parent
6e5d5cdf40
commit
5bbb21aad5
|
@ -1108,6 +1108,21 @@ public class Element extends Base implements NamedItem {
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<Element> getExtensions(String url) {
|
||||
List<Element> list = new ArrayList<>();
|
||||
if (children != null) {
|
||||
for (Element child : children) {
|
||||
if (extensionList.contains(child.getName())) {
|
||||
String u = child.getChildValue("url");
|
||||
if (url.equals(u)) {
|
||||
list.add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Base getExtensionValue(String url) {
|
||||
if (children != null) {
|
||||
for (Element child : children) {
|
||||
|
|
|
@ -1107,4 +1107,5 @@ public class I18nConstants {
|
|||
public static final String TYPE_SPECIFIC_CHECKS_DT_XHTML_LITERAL_HREF = "TYPE_SPECIFIC_CHECKS_DT_XHTML_LITERAL_HREF";
|
||||
public static final String SM_TARGET_TYPE_UNKNOWN = "SM_TARGET_TYPE_UNKNOWN";
|
||||
public static final String XHTML_XHTML_ATTRIBUTE_XML_SPACE = "XHTML_XHTML_ATTRIBUTE_XML_SPACE";
|
||||
public static final String VALIDATION_HL7_PUBLISHER_MULTIPLE_WGS = "VALIDATION_HL7_PUBLISHER_MULTIPLE_WGS";
|
||||
}
|
||||
|
|
|
@ -1137,4 +1137,5 @@ TYPE_SPECIFIC_CHECKS_DT_XHTML_UNKNOWN_HREF = Hyperlink scheme ''{3}'' in ''{0}''
|
|||
TYPE_SPECIFIC_CHECKS_DT_XHTML_LITERAL_HREF = Hyperlink scheme ''{3}'' in ''{0}'' at ''{1}'' for ''{2}'' is not a valid hyperlinkable scheme
|
||||
SM_TARGET_TYPE_UNKNOWN = The type of the target variable is not known: {0}
|
||||
XHTML_XHTML_ATTRIBUTE_XML_SPACE = The attribute 'xml:space' is legal but has a fixed value of 'preserve'. It''s use is discouraged
|
||||
VALIDATION_HL7_PUBLISHER_MULTIPLE_WGS = This resource has more than workgroup extension (http://hl7.org/fhir/StructureDefinition/structuredefinition-wg)
|
||||
|
|
@ -5730,13 +5730,15 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
|
||||
private boolean checkPublisherConsistency(ValidationContext valContext, List<ValidationMessage> errors, Element element, NodeStack stack, boolean contained) {
|
||||
|
||||
boolean ok = true;
|
||||
String pub = element.getNamedChildValue("publisher", false);
|
||||
|
||||
ok = rule(errors, "2024-08-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), element.getExtensions(ToolingExtensions.EXT_WORKGROUP).size() <= 1, I18nConstants.VALIDATION_HL7_PUBLISHER_MULTIPLE_WGS) && ok;
|
||||
Base wgT = element.getExtensionValue(ToolingExtensions.EXT_WORKGROUP);
|
||||
String wg = wgT == null ? null : wgT.primitiveValue();
|
||||
String url = element.getNamedChildValue("url");
|
||||
|
||||
if (contained && wg == null) {
|
||||
boolean ok = true;
|
||||
Element container = valContext.getRootResource();
|
||||
if (element.hasExtension(ToolingExtensions.EXT_WORKGROUP)) {
|
||||
// container already specified the HL7 WG, so we don't need to test
|
||||
|
@ -5775,9 +5777,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (rule(errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), wgd != null, I18nConstants.VALIDATION_HL7_WG_UNKNOWN, wg)) {
|
||||
String rpub = "HL7 International / "+wgd.getName();
|
||||
if (warning(errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), pub != null, I18nConstants.VALIDATION_HL7_PUBLISHER_MISSING, wg, rpub)) {
|
||||
boolean ok = rpub.equals(pub);
|
||||
ok = rpub.equals(pub) && ok;
|
||||
if (!ok && wgd.getName2() != null) {
|
||||
ok = ("HL7 International / "+wgd.getName2()).equals(pub);
|
||||
ok = ("HL7 International / "+wgd.getName2()).equals(pub) && ok;
|
||||
warningOrError(pub.contains("/"), errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), ok, I18nConstants.VALIDATION_HL7_PUBLISHER_MISMATCH2, wg, rpub, "HL7 International / "+wgd.getName2(), pub);
|
||||
} else {
|
||||
warningOrError(pub.contains("/"), errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), ok, I18nConstants.VALIDATION_HL7_PUBLISHER_MISMATCH, wg, rpub, pub);
|
||||
|
@ -5785,14 +5787,14 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
warning(errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(),
|
||||
Utilities.startsWithInList( wgd.getLink(), urls), I18nConstants.VALIDATION_HL7_WG_URL, wg, wgd.getLink());
|
||||
return true;
|
||||
return ok;
|
||||
}
|
||||
} else {
|
||||
return true; // HL7 sid.
|
||||
return ok; // HL7 sid.
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return ok;
|
||||
}
|
||||
|
||||
private boolean statusCodesConsistent(String status, String standardsStatus) {
|
||||
|
|
Loading…
Reference in New Issue