(rename fields)

This commit is contained in:
Grahame Grieve 2024-10-08 05:55:52 +08:00
parent eb149f5abd
commit 10d854f242
1 changed files with 13 additions and 13 deletions

View File

@ -58,21 +58,21 @@ public class Validator {
private FHIRPathEngine fpe; private FHIRPathEngine fpe;
private List<String> prohibitedNames = new ArrayList<String>(); private List<String> prohibitedNames = new ArrayList<String>();
private List<ValidationMessage> issues = new ArrayList<ValidationMessage>(); private List<ValidationMessage> issues = new ArrayList<ValidationMessage>();
private TrueFalseOrUnknown arrays; private TrueFalseOrUnknown supportsArrays;
private TrueFalseOrUnknown complexTypes; private TrueFalseOrUnknown supportsComplexTypes;
private TrueFalseOrUnknown needsName; private TrueFalseOrUnknown supportsNeedsName;
private String resourceName; private String resourceName;
private String name; private String name;
public Validator(IWorkerContext context, FHIRPathEngine fpe, List<String> prohibitedNames, TrueFalseOrUnknown arrays, TrueFalseOrUnknown complexTypes, TrueFalseOrUnknown needsName) { public Validator(IWorkerContext context, FHIRPathEngine fpe, List<String> prohibitedNames, TrueFalseOrUnknown supportsArrays, TrueFalseOrUnknown supportsComplexTypes, TrueFalseOrUnknown supportsNeedsName) {
super(); super();
this.context = context; this.context = context;
this.fpe = fpe; this.fpe = fpe;
this.prohibitedNames = prohibitedNames; this.prohibitedNames = prohibitedNames;
this.arrays = arrays; this.supportsArrays = supportsArrays;
this.complexTypes = complexTypes; this.supportsComplexTypes = supportsComplexTypes;
this.needsName = needsName; this.supportsNeedsName = supportsNeedsName;
} }
public String getResourceName() { public String getResourceName() {
@ -85,9 +85,9 @@ public class Validator {
JsonElement nameJ = viewDefinition.get("name"); JsonElement nameJ = viewDefinition.get("name");
if (nameJ == null) { if (nameJ == null) {
if (needsName == null) { if (supportsNeedsName == null) {
hint(path, viewDefinition, "No name provided. A name is required in many contexts where a ViewDefinition is used"); hint(path, viewDefinition, "No name provided. A name is required in many contexts where a ViewDefinition is used");
} else if (needsName == TrueFalseOrUnknown.TRUE) { } else if (supportsNeedsName == TrueFalseOrUnknown.TRUE) {
error(path, viewDefinition, "No name provided", IssueType.REQUIRED); error(path, viewDefinition, "No name provided", IssueType.REQUIRED);
} }
} else if (!(nameJ instanceof JsonString)) { } else if (!(nameJ instanceof JsonString)) {
@ -339,9 +339,9 @@ public class Validator {
hint(path, column, "collection is true, but the path statement(s) can only return single values for the column '"+columnName+"'"); hint(path, column, "collection is true, but the path statement(s) can only return single values for the column '"+columnName+"'");
} }
} else { } else {
if (arrays == TrueFalseOrUnknown.UNKNOWN) { if (supportsArrays == TrueFalseOrUnknown.UNKNOWN) {
warning(path, expression, "The column '"+columnName+"' appears to be a collection based on it's path. Collections are not supported in all execution contexts"); warning(path, expression, "The column '"+columnName+"' appears to be a collection based on it's path. Collections are not supported in all execution contexts");
} else if (arrays == TrueFalseOrUnknown.FALSE) { } else if (supportsArrays == TrueFalseOrUnknown.FALSE) {
warning(path, expression, "The column '"+columnName+"' appears to be a collection based on it's path, but this is not allowed in the current execution context"); warning(path, expression, "The column '"+columnName+"' appears to be a collection based on it's path, but this is not allowed in the current execution context");
} }
if (td.getCollectionStatus() != CollectionStatus.SINGLETON) { if (td.getCollectionStatus() != CollectionStatus.SINGLETON) {
@ -378,9 +378,9 @@ public class Validator {
String type = types.iterator().next(); String type = types.iterator().next();
boolean ok = false; boolean ok = false;
if (!isSimpleType(type) && !"null".equals(type)) { if (!isSimpleType(type) && !"null".equals(type)) {
if (complexTypes == TrueFalseOrUnknown.UNKNOWN) { if (supportsComplexTypes == TrueFalseOrUnknown.UNKNOWN) {
warning(path, expression, "Column is a complex type. This is not supported in some Runners"); warning(path, expression, "Column is a complex type. This is not supported in some Runners");
} else if (complexTypes == TrueFalseOrUnknown.FALSE) { } else if (supportsComplexTypes == TrueFalseOrUnknown.FALSE) {
error(path, expression, "Column is a complex type but this is not allowed in this context", IssueType.BUSINESSRULE); error(path, expression, "Column is a complex type but this is not allowed in this context", IssueType.BUSINESSRULE);
} else { } else {
ok = true; ok = true;