Merge branch 'master' of https://github.com/hapifhir/org.hl7.fhir.core
This commit is contained in:
commit
203de627f1
|
@ -218,7 +218,9 @@ public class InstantType extends BaseDateTimeType {
|
|||
|
||||
@Override
|
||||
public InstantType copy() {
|
||||
return new InstantType(getValue());
|
||||
InstantType ret = new InstantType();
|
||||
ret.setValueAsString(getValueAsString());
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -218,7 +218,9 @@ public class InstantType extends BaseDateTimeType {
|
|||
|
||||
@Override
|
||||
public InstantType copy() {
|
||||
return new InstantType(getValueAsString());
|
||||
InstantType ret = new InstantType();
|
||||
ret.setValueAsString(getValueAsString());
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -218,7 +218,8 @@ public class InstantType extends BaseDateTimeType {
|
|||
|
||||
@Override
|
||||
public InstantType copy() {
|
||||
InstantType ret = new InstantType(getValueAsString());
|
||||
InstantType ret = new InstantType();
|
||||
ret.setValueAsString(getValueAsString());
|
||||
copyValues(ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -686,8 +686,9 @@ public class ResourceFactory extends Factory {
|
|||
case 116076: return new UriType();
|
||||
case 116079: return new UrlType();
|
||||
case 3601339: return new UuidType();
|
||||
case 114035747: return new XhtmlType();
|
||||
default:
|
||||
throw new FHIRException("Unknown Resource or Type Name '"+name+"'");
|
||||
throw new FHIRException("Unknown Resource or Type Name '"+name+"': " + name.hashCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ public class XhtmlType extends Element {
|
|||
}
|
||||
|
||||
public XhtmlType() {
|
||||
this(new Narrative());
|
||||
// "<div xmlns=\""+FormatUtilities.XHTML_NS+"\"></div>"
|
||||
}
|
||||
|
||||
|
|
|
@ -218,7 +218,8 @@ public class InstantType extends BaseDateTimeType {
|
|||
|
||||
@Override
|
||||
public InstantType copy() {
|
||||
InstantType ret = new InstantType(getValueAsString());
|
||||
InstantType ret = new InstantType();
|
||||
ret.setValueAsString(getValueAsString());
|
||||
copyValues(ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -85,6 +85,13 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.18</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -149,16 +149,22 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively look for answers to questions with the given link id
|
||||
*/
|
||||
private List<Element> findQuestionAnswers(Element questionnaireResponse, String question) {
|
||||
List<Element> matchingItems = questionnaireResponse.getChildren(ITEM_ELEMENT)
|
||||
.stream()
|
||||
.flatMap(i -> findSubItems(i).stream())
|
||||
.filter(i -> hasLinkId(i, question))
|
||||
.collect(Collectors.toList());
|
||||
return matchingItems
|
||||
.stream()
|
||||
.flatMap(e -> extractAnswer(e).stream())
|
||||
.collect(Collectors.toList());
|
||||
List<Element> retVal = new ArrayList<>();
|
||||
|
||||
List<Element> items = questionnaireResponse.getChildren(ITEM_ELEMENT);
|
||||
for (Element next : items) {
|
||||
if (hasLinkId(next, question)) {
|
||||
List<Element> answers = extractAnswer(next);
|
||||
retVal.addAll(answers);
|
||||
}
|
||||
retVal.addAll(findQuestionAnswers(next, question));
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private List<Element> extractAnswer(Element item) {
|
||||
|
@ -197,14 +203,6 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
private List<Element> findSubItems(Element item) {
|
||||
List<Element> results = item.getChildren(LINKID_ELEMENT)
|
||||
.stream()
|
||||
.flatMap(i -> findSubItems(i).stream())
|
||||
.collect(Collectors.toList());
|
||||
results.add(item);
|
||||
return results;
|
||||
}
|
||||
|
||||
private boolean hasLinkId(Element item, String linkId) {
|
||||
Element linkIdChild = item.getNamedChild(LINKID_ELEMENT);
|
||||
|
|
|
@ -2162,7 +2162,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
long t = System.nanoTime();
|
||||
StructureDefinition sd = context.fetchResource(StructureDefinition.class, url);
|
||||
sdTime = sdTime + (System.nanoTime() - t);
|
||||
if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals(type)) && sd.hasSnapshot())
|
||||
if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals("http://hl7.org/fhir/StructureDefinition/" + type)) && sd.hasSnapshot())
|
||||
return sd;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -149,16 +149,22 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively look for answers to questions with the given link id
|
||||
*/
|
||||
private List<Element> findQuestionAnswers(Element questionnaireResponse, String question) {
|
||||
List<Element> matchingItems = questionnaireResponse.getChildren(ITEM_ELEMENT)
|
||||
.stream()
|
||||
.flatMap(i -> findSubItems(i).stream())
|
||||
.filter(i -> hasLinkId(i, question))
|
||||
.collect(Collectors.toList());
|
||||
return matchingItems
|
||||
.stream()
|
||||
.flatMap(e -> extractAnswer(e).stream())
|
||||
.collect(Collectors.toList());
|
||||
List<Element> retVal = new ArrayList<>();
|
||||
|
||||
List<Element> items = questionnaireResponse.getChildren(ITEM_ELEMENT);
|
||||
for (Element next : items) {
|
||||
if (hasLinkId(next, question)) {
|
||||
List<Element> answers = extractAnswer(next);
|
||||
retVal.addAll(answers);
|
||||
}
|
||||
retVal.addAll(findQuestionAnswers(next, question));
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private List<Element> extractAnswer(Element item) {
|
||||
|
@ -197,14 +203,6 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
private List<Element> findSubItems(Element item) {
|
||||
List<Element> results = item.getChildren(ITEM_ELEMENT)
|
||||
.stream()
|
||||
.flatMap(i -> findSubItems(i).stream())
|
||||
.collect(Collectors.toList());
|
||||
results.add(item);
|
||||
return results;
|
||||
}
|
||||
|
||||
private boolean hasLinkId(Element item, String linkId) {
|
||||
Element linkIdChild = item.getNamedChild(LINKID_ELEMENT);
|
||||
|
|
|
@ -2172,7 +2172,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
long t = System.nanoTime();
|
||||
StructureDefinition sd = context.fetchResource(StructureDefinition.class, url);
|
||||
sdTime = sdTime + (System.nanoTime() - t);
|
||||
if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals(type)) && sd.hasSnapshot())
|
||||
if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals("http://hl7.org/fhir/StructureDefinition/" + type)) && sd.hasSnapshot())
|
||||
return sd;
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue