control over aggregation validation

This commit is contained in:
Grahame Grieve 2020-08-27 16:22:21 +10:00
parent de5310c13a
commit 9578933704
3 changed files with 17 additions and 3 deletions

View File

@ -205,6 +205,8 @@ public interface IResourceValidator {
public boolean isAllowExamples();
public void setAllowExamples(boolean value) ;
public boolean isNoCheckAggregation();
public void setNoCheckAggregation(boolean value);
/**
* CrumbTrail - whether the validator creates hints to
* @return

View File

@ -102,7 +102,7 @@ Questionnaire_Q_EnableWhen_IsInner = Questions with an enableWhen cannot refer t
Questionnaire_Q_EnableWhen_NoLink = Questions with an enableWhen must have a value for the question link
Questionnaire_Q_EnableWhen_NoTarget = Unable to find an item with the linkId ''{0}'' which is referenced in the enableWhen for ''{1}''
Questionnaire_Q_EnableWhen_Self = Target for this question enableWhen can''t reference itself
Reference_REF_Aggregation = Reference is {0} which isn''t supported by the specified aggregation mode(s) for the reference
Reference_REF_Aggregation = Reference is {0} which isn''t supported by the specified aggregation mode(s) for the reference ({1})
Reference_REF_BadTargetType = Invalid Resource target type. Found {0}, but expected one of ({1})
Reference_REF_BadTargetType2 = The type ''{0}'' implied by the reference URL {1} is not a valid Target for this element (must be one of {2})
Reference_REF_CantMatchChoice = Unable to find matching profile for {0} among choices: {1}

View File

@ -333,6 +333,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
private BestPracticeWarningLevel bpWarnings;
private String validationLanguage;
private boolean baseOnly;
private boolean noCheckAggregation;
private List<ImplementationGuide> igs = new ArrayList<>();
private List<String> extensionDomains = new ArrayList<String>();
@ -2535,9 +2536,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ok, I18nConstants.REFERENCE_REF_BADTARGETTYPE, ft, types.toString());
}
if (type.hasAggregation()) {
if (type.hasAggregation() && !noCheckAggregation) {
boolean modeOk = false;
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (Enumeration<AggregationMode> mode : type.getAggregation()) {
b.append(mode.getCode());
if (mode.getValue().equals(AggregationMode.CONTAINED) && refType.equals("contained"))
modeOk = true;
else if (mode.getValue().equals(AggregationMode.BUNDLED) && refType.equals("bundled"))
@ -2545,7 +2548,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
else if (mode.getValue().equals(AggregationMode.REFERENCED) && (refType.equals("bundled") || refType.equals("remote")))
modeOk = true;
}
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, modeOk, I18nConstants.REFERENCE_REF_AGGREGATION, refType);
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, modeOk, I18nConstants.REFERENCE_REF_AGGREGATION, refType, b.toString());
}
}
}
@ -4892,4 +4895,13 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
this.validateValueSetCodesOnTxServer = value;
}
public boolean isNoCheckAggregation() {
return noCheckAggregation;
}
public void setNoCheckAggregation(boolean noCheckAggregation) {
this.noCheckAggregation = noCheckAggregation;
}
}