Include checkIPSCodes and bundleValidationRules in json (#1473)

+ gentle renaming
This commit is contained in:
dotasek 2023-10-31 09:49:37 -04:00 committed by GitHub
parent 8c75881ca1
commit 7386b2b8f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 18 deletions

View File

@ -1,24 +1,37 @@
package org.hl7.fhir.r5.utils.validation;
import com.fasterxml.jackson.annotation.JsonProperty;
public class BundleValidationRule {
@JsonProperty("rule")
private String rule;
@JsonProperty("profile")
private String profile;
private boolean checked;
public BundleValidationRule(String rule, String profile) {
super();
this.rule = rule;
this.profile = profile;
}
@JsonProperty("rule")
public String getRule() {
return rule;
}
@JsonProperty("rule")
public BundleValidationRule setRule(String rule) {
this.rule = rule;
return this;
}
@JsonProperty("profile")
public String getProfile() {
return profile;
}
@JsonProperty("profile")
public BundleValidationRule setProfile(String profile) {
this.profile = profile;
return this;
}
public boolean isChecked() {
return checked;
}

View File

@ -131,8 +131,8 @@ public class CliContext {
@JsonProperty("outputStyle")
private String outputStyle = null;
// TODO: Mark what goes here?
@JsonProperty("bundleValidationRules")
private List<BundleValidationRule> bundleValidationRules = new ArrayList<>();
@JsonProperty("jurisdiction")
@ -191,11 +191,17 @@ public class CliContext {
return this;
}
// TODO: Mark what goes here?
@JsonProperty("bundleValidationRules")
public List<BundleValidationRule> getBundleValidationRules() {
return bundleValidationRules;
}
@JsonProperty("bundleValidationRules")
public CliContext setBundleValidationRules(List<BundleValidationRule> bundleValidationRules) {
this.bundleValidationRules = bundleValidationRules;
return this;
}
public CliContext addIg(String ig) {
if (this.igs == null) {
this.igs = new ArrayList<>();
@ -322,14 +328,18 @@ public class CliContext {
this.allowDoubleQuotesInFHIRPath = allowDoubleQuotesInFHIRPath;
}
@JsonProperty("checkIPSCodes")
public boolean isCheckIPSCodes() {
return checkIPSCodes;
}
public void setCheckIPSCodes(boolean checkIPSCodes) {
@JsonProperty("checkIPSCodes")
public CliContext setCheckIPSCodes(boolean checkIPSCodes) {
this.checkIPSCodes = checkIPSCodes;
return this;
}
@JsonProperty("locale")
public String getLanguageCode() {
return locale;

View File

@ -181,25 +181,25 @@ public class Params {
cliContext.addProfile(p);
}
} else if (args[i].equals(BUNDLE)) {
String p = null;
String r = null;
String profile = null;
String rule = null;
if (i + 1 == args.length) {
throw new Error("Specified -profile without indicating bundle rule ");
} else {
r = args[++i];
rule = args[++i];
}
if (i + 1 == args.length) {
throw new Error("Specified -profile without indicating profile source");
} else {
p = args[++i];
profile = args[++i];
}
cliContext.getBundleValidationRules().add(new BundleValidationRule(r, p));
cliContext.getBundleValidationRules().add(new BundleValidationRule().setRule(rule).setProfile(profile));
} else if (args[i].equals(QUESTIONNAIRE)) {
if (i + 1 == args.length)
throw new Error("Specified -questionnaire without indicating questionnaire mode");
else {
String q = args[++i];
cliContext.setQuestionnaireMode(QuestionnaireMode.fromCode(q));
String questionnaireMode = args[++i];
cliContext.setQuestionnaireMode(QuestionnaireMode.fromCode(questionnaireMode));
}
} else if (args[i].equals(LEVEL)) {
if (i + 1 == args.length)

View File

@ -287,7 +287,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
}
val.getBundleValidationRules().clear();
if (content.has("bundle-param")) {
val.getBundleValidationRules().add(new BundleValidationRule(content.getAsJsonObject("bundle-param").get("rule").getAsString(), content.getAsJsonObject("bundle-param").get("profile").getAsString()));
val.getBundleValidationRules().add(new BundleValidationRule().setRule(content.getAsJsonObject("bundle-param").get("rule").getAsString()).setProfile( content.getAsJsonObject("bundle-param").get("profile").getAsString()));
}
if (content.has("profiles")) {
for (JsonElement je : content.getAsJsonArray("profiles")) {