use of org.hl7.fhir.dstu2.model.Base in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method funcDescendants.
private List<Base> funcDescendants(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
List<Base> result = new ArrayList<Base>();
List<Base> current = new ArrayList<Base>();
current.addAll(focus);
List<Base> added = new ArrayList<Base>();
boolean more = true;
while (more) {
added.clear();
for (Base item : current) {
getChildrenByName(item, "*", added);
}
more = !added.isEmpty();
result.addAll(added);
current.clear();
current.addAll(added);
}
return result;
}
use of org.hl7.fhir.dstu2.model.Base in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method log.
private void log(String name, List<Base> contents) {
if (hostServices == null || !hostServices.Log(name, contents)) {
if (log.length() > 0)
log.append("; ");
log.append(name);
log.append(": ");
boolean first = true;
for (Base b : contents) {
if (first)
first = false;
else
log.append(",");
log.append(convertToString(b));
}
}
}
use of org.hl7.fhir.dstu2.model.Base in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method opConcatenate.
private List<Base> opConcatenate(List<Base> left, List<Base> right) {
List<Base> result = new ArrayList<Base>();
result.add(new StringType(convertToString(left) + convertToString((right))));
return result;
}
use of org.hl7.fhir.dstu2.model.Base in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method funcExists.
private List<Base> funcExists(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
List<Base> result = new ArrayList<Base>();
// R2 - can't use ElementUtil
result.add(new BooleanType(!focus.isEmpty()));
return result;
}
use of org.hl7.fhir.dstu2.model.Base in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method funcSubsetOf.
private List<Base> funcSubsetOf(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws PathEngineException {
List<Base> target = execute(context, focus, exp.getParameters().get(0), true);
boolean valid = true;
for (Base item : focus) {
boolean found = false;
for (Base t : target) {
if (Base.compareDeep(item, t, false)) {
found = true;
break;
}
}
if (!found) {
valid = false;
break;
}
}
List<Base> result = new ArrayList<Base>();
result.add(new BooleanType(valid));
return result;
}
Aggregations