fix misleading error message + uppate for new release of tests
This commit is contained in:
parent
210864978e
commit
786aa001c5
|
@ -532,7 +532,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return new ValueSetExpansionOutcome(vs.copy());
|
||||
}
|
||||
if (!vs.hasUrl())
|
||||
throw new Error(formatMessage(I18nConstants.NO_VALUE_SET));
|
||||
throw new Error(formatMessage(I18nConstants.NO_VALUE_SET_IN_URL));
|
||||
|
||||
CacheToken cacheToken = txCache.generateExpandToken(vs, heirarchical);
|
||||
ValueSetExpansionOutcome res;
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.hl7.fhir.r5.renderers;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
import org.hl7.fhir.r5.model.DomainResource;
|
||||
|
@ -10,9 +11,11 @@ import org.hl7.fhir.r5.model.Expression;
|
|||
import org.hl7.fhir.r5.model.Extension;
|
||||
import org.hl7.fhir.r5.model.Questionnaire;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent;
|
||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemInitialComponent;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
|
||||
|
@ -258,7 +261,73 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
p.tx(": ");
|
||||
}
|
||||
p.span(null, "linkId: "+i.getLinkId()).tx(i.getText());
|
||||
if (i.getRequired()) {
|
||||
p.span("color: red", "Mandatory").tx(" *");
|
||||
}
|
||||
|
||||
XhtmlNode input = null;
|
||||
switch (i.getType()) {
|
||||
case STRING:
|
||||
p.tx(" ");
|
||||
input = p.input(i.getLinkId(), "text", i.getType().getDisplay(), 60);
|
||||
break;
|
||||
case ATTACHMENT:
|
||||
break;
|
||||
case BOOLEAN:
|
||||
p.tx(" ");
|
||||
input = p.input(i.getLinkId(), "checkbox", i.getType().getDisplay(), 1);
|
||||
break;
|
||||
case CHOICE:
|
||||
input = p.select(i.getLinkId());
|
||||
listOptions(q, i, input);
|
||||
break;
|
||||
case DATE:
|
||||
p.tx(" ");
|
||||
input = p.input(i.getLinkId(), "date", i.getType().getDisplay(), 10);
|
||||
break;
|
||||
case DATETIME:
|
||||
p.tx(" ");
|
||||
input = p.input(i.getLinkId(), "datetime-local", i.getType().getDisplay(), 25);
|
||||
break;
|
||||
case DECIMAL:
|
||||
p.tx(" ");
|
||||
input = p.input(i.getLinkId(), "number", i.getType().getDisplay(), 15);
|
||||
break;
|
||||
case DISPLAY:
|
||||
break;
|
||||
case GROUP:
|
||||
break;
|
||||
case INTEGER:
|
||||
p.tx(" ");
|
||||
input = p.input(i.getLinkId(), "number", i.getType().getDisplay(), 10);
|
||||
break;
|
||||
case OPENCHOICE:
|
||||
break;
|
||||
case QUANTITY:
|
||||
p.tx(" ");
|
||||
input = p.input(i.getLinkId(), "number", "value", 15);
|
||||
p.tx(" ");
|
||||
input = p.input(i.getLinkId(), "unit", "unit", 10);
|
||||
break;
|
||||
case QUESTION:
|
||||
break;
|
||||
case REFERENCE:
|
||||
break;
|
||||
case TEXT:
|
||||
break;
|
||||
case TIME:
|
||||
break;
|
||||
case URL:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (input != null) {
|
||||
if (i.getReadOnly()) {
|
||||
input.attribute("readonly", "1");
|
||||
}
|
||||
|
||||
}
|
||||
int t = 1;
|
||||
for (QuestionnaireItemComponent c : i.getItem()) {
|
||||
hasExt = renderFormItem(d, q, c, pfx == null ? null : pfx+"."+Integer.toString(t), false) || hasExt;
|
||||
|
@ -267,6 +336,32 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
return hasExt;
|
||||
}
|
||||
|
||||
private void listOptions(Questionnaire q, QuestionnaireItemComponent i, XhtmlNode select) {
|
||||
if (i.hasAnswerValueSet()) {
|
||||
ValueSet vs = null;
|
||||
if (i.getAnswerValueSet().startsWith("#")) {
|
||||
vs = (ValueSet) q.getContained(i.getAnswerValueSet().substring(1)).copy();
|
||||
if (vs != null && !vs.hasUrl()) {
|
||||
vs.setUrl("urn:uuid:"+UUID.randomUUID().toString().toLowerCase());
|
||||
}
|
||||
} else {
|
||||
vs = context.getContext().fetchResource(ValueSet.class, i.getAnswerValueSet());
|
||||
}
|
||||
if (vs != null) {
|
||||
ValueSetExpansionOutcome exp = context.getContext().expandVS(vs, true, false);
|
||||
if (exp.getValueset() != null) {
|
||||
for (ValueSetExpansionContainsComponent cc : exp.getValueset().getExpansion().getContains()) {
|
||||
select.option(cc.getCode(), cc.hasDisplay() ? cc.getDisplay() : cc.getCode(), false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (i.hasAnswerOption()) {
|
||||
|
||||
}
|
||||
select.option("a", "??", false);
|
||||
}
|
||||
|
||||
public String display(DomainResource dr) throws UnsupportedEncodingException, IOException {
|
||||
return display((Questionnaire) dr);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.fhir.ucum.UcumEssenceService;
|
|||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.model.Parameters;
|
||||
import org.hl7.fhir.r5.terminologies.TerminologyClientR5;
|
||||
import org.hl7.fhir.utilities.CSFile;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
@ -88,6 +89,7 @@ public class TestingUtilities {
|
|||
IWorkerContext fcontext = SimpleWorkerContext.fromPackage(pcm.loadPackage(VersionUtilities.packageForVersion(version), version));
|
||||
fcontext.setUcumService(new UcumEssenceService(TestingUtilities.loadTestResourceStream("ucum", "ucum-essence.xml")));
|
||||
fcontext.setExpansionProfile(new Parameters());
|
||||
// ((SimpleWorkerContext) fcontext).connectToTSServer(new TerminologyClientR5("http://tx.fhir.org/r4"), null);
|
||||
fcontexts.put(v, fcontext);
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
|
|
|
@ -408,7 +408,7 @@ public class I18nConstants {
|
|||
public final static String CAN_ONLY_SPECIFY_PROFILE_IN_THE_CONTEXT = "Can_only_specify_profile_in_the_context";
|
||||
public final static String NO_URL_IN_EXPAND_VALUE_SET_2 = "no_url_in_expand_value_set_2";
|
||||
public final static String NO_URL_IN_EXPAND_VALUE_SET = "no_url_in_expand_value_set";
|
||||
public final static String NO_VALUE_SET = "no_value_set";
|
||||
public final static String NO_VALUE_SET_IN_URL = "no_value_set";
|
||||
public final static String NO_PARAMETERS_PROVIDED_TO_EXPANDVS = "No_Parameters_provided_to_expandVS";
|
||||
public final static String NO_EXPANSION_PARAMETERS_PROVIDED = "No_Expansion_Parameters_provided";
|
||||
public final static String UNABLE_TO_RESOLVE_VALUE_SET_ = "Unable_to_resolve_value_Set_";
|
||||
|
|
|
@ -659,4 +659,34 @@ public class XhtmlNode implements IBaseXhtml {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
public XhtmlNode input(String name, String type, String placeholder, int size) {
|
||||
XhtmlNode p = new XhtmlNode(NodeType.Element, "input");
|
||||
p.attribute("name", name);
|
||||
p.attribute("type", type);
|
||||
p.attribute("placeholder", placeholder);
|
||||
p.attribute("size", Integer.toString(size));
|
||||
getChildNodes().add(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
public XhtmlNode select(String name) {
|
||||
XhtmlNode p = new XhtmlNode(NodeType.Element, "select");
|
||||
p.attribute("name", name);
|
||||
p.attribute("size", "1");
|
||||
getChildNodes().add(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
public XhtmlNode option(String value, String text, boolean selected) {
|
||||
XhtmlNode p = new XhtmlNode(NodeType.Element, "option");
|
||||
p.attribute("value", value);
|
||||
p.attribute("selected", Boolean.toString(selected));
|
||||
p.tx(text);
|
||||
getChildNodes().add(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -398,7 +398,7 @@ No_ExpansionProfile_provided = No ExpansionProfile provided
|
|||
Can_only_specify_profile_in_the_context = Can only specify profile in the context
|
||||
no_url_in_expand_value_set_2 = no url in expand value set 2
|
||||
no_url_in_expand_value_set = no url in expand value set
|
||||
no_value_set = no value set
|
||||
no_value_set = value set has no url property
|
||||
No_Parameters_provided_to_expandVS = No Parameters provided to expandVS
|
||||
No_Expansion_Parameters_provided = No Expansion Parameters provided
|
||||
Unable_to_resolve_value_Set_ = Unable to resolve value Set {0}
|
||||
|
|
|
@ -160,7 +160,7 @@ import com.google.gson.JsonObject;
|
|||
|
||||
/**
|
||||
* Thinking of using this in a java program? Don't!
|
||||
* You should use one of the wrappers instead. Either in HAPI, or use ValidationEngine, or NativeHostServices
|
||||
* You should use one of the wrappers instead. Either in HAPI, or use ValidationEngine
|
||||
* <p>
|
||||
* Validation todo:
|
||||
* - support @default slices
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -17,7 +17,7 @@
|
|||
|
||||
<properties>
|
||||
<hapi_fhir_version>5.0.0</hapi_fhir_version>
|
||||
<validator_test_case_version>1.1.14-SNAPSHOT</validator_test_case_version>
|
||||
<validator_test_case_version>1.1.14</validator_test_case_version>
|
||||
<junit_jupiter_version>5.6.2</junit_jupiter_version>
|
||||
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
|
||||
<jacoco_version>0.8.5</jacoco_version>
|
||||
|
|
Loading…
Reference in New Issue