use of org.hl7.fhir.dstu2016may.model.Base in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method evaluate.
/**
* evaluate a path and return the matching elements
*
* @param base - the object against which the path is being evaluated
* @param path - the FHIR Path statement to use
* @return
* @throws PathEngineException
* @throws FHIRLexerException
* @
* @
*/
public List<Base> evaluate(Object appContext, Resource resource, Base base, String path) throws PathEngineException, FHIRLexerException {
ExpressionNode exp = parse(path);
List<Base> list = new ArrayList<Base>();
if (base != null)
list.add(base);
log = new StringBuilder();
return execute(new ExecutionContext(appContext, resource, base, base), list, exp, true);
}
use of org.hl7.fhir.dstu2016may.model.Base in project org.hl7.fhir.core by hapifhir.
the class PrimitiveType method equalsDeep.
@Override
public boolean equalsDeep(Base obj) {
if (!super.equalsDeep(obj))
return false;
if (obj == null) {
return false;
}
if (!(obj.getClass() == getClass())) {
return false;
}
PrimitiveType<?> o = (PrimitiveType<?>) obj;
EqualsBuilder b = new EqualsBuilder();
b.append(getValue(), o.getValue());
return b.isEquals();
}
use of org.hl7.fhir.dstu2016may.model.Base in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeVisionPrescriptionVisionPrescriptionDispenseComponent.
protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(Complex parent, String parentType, String name, VisionPrescription.VisionPrescriptionDispenseComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "dispense", name, element, index);
if (element.hasProduct())
composeCoding(t, "VisionPrescription", "product", element.getProduct(), -1);
if (element.hasEyeElement())
composeEnum(t, "VisionPrescription", "eye", element.getEyeElement(), -1);
if (element.hasSphereElement())
composeDecimal(t, "VisionPrescription", "sphere", element.getSphereElement(), -1);
if (element.hasCylinderElement())
composeDecimal(t, "VisionPrescription", "cylinder", element.getCylinderElement(), -1);
if (element.hasAxisElement())
composeInteger(t, "VisionPrescription", "axis", element.getAxisElement(), -1);
if (element.hasPrismElement())
composeDecimal(t, "VisionPrescription", "prism", element.getPrismElement(), -1);
if (element.hasBaseElement())
composeEnum(t, "VisionPrescription", "base", element.getBaseElement(), -1);
if (element.hasAddElement())
composeDecimal(t, "VisionPrescription", "add", element.getAddElement(), -1);
if (element.hasPowerElement())
composeDecimal(t, "VisionPrescription", "power", element.getPowerElement(), -1);
if (element.hasBackCurveElement())
composeDecimal(t, "VisionPrescription", "backCurve", element.getBackCurveElement(), -1);
if (element.hasDiameterElement())
composeDecimal(t, "VisionPrescription", "diameter", element.getDiameterElement(), -1);
if (element.hasDuration())
composeQuantity(t, "VisionPrescription", "duration", element.getDuration(), -1);
if (element.hasColorElement())
composeString(t, "VisionPrescription", "color", element.getColorElement(), -1);
if (element.hasBrandElement())
composeString(t, "VisionPrescription", "brand", element.getBrandElement(), -1);
if (element.hasNotesElement())
composeString(t, "VisionPrescription", "notes", element.getNotesElement(), -1);
}
use of org.hl7.fhir.dstu2016may.model.Base in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeSearchParameter.
protected void composeSearchParameter(Complex parent, String parentType, String name, SearchParameter element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "SearchParameter", name, element, index);
if (element.hasUrlElement())
composeUri(t, "SearchParameter", "url", element.getUrlElement(), -1);
if (element.hasNameElement())
composeString(t, "SearchParameter", "name", element.getNameElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "SearchParameter", "status", element.getStatusElement(), -1);
if (element.hasExperimentalElement())
composeBoolean(t, "SearchParameter", "experimental", element.getExperimentalElement(), -1);
if (element.hasDateElement())
composeDateTime(t, "SearchParameter", "date", element.getDateElement(), -1);
if (element.hasPublisherElement())
composeString(t, "SearchParameter", "publisher", element.getPublisherElement(), -1);
for (int i = 0; i < element.getContact().size(); i++) composeSearchParameterSearchParameterContactComponent(t, "SearchParameter", "contact", element.getContact().get(i), i);
for (int i = 0; i < element.getUseContext().size(); i++) composeCodeableConcept(t, "SearchParameter", "useContext", element.getUseContext().get(i), i);
if (element.hasRequirementsElement())
composeString(t, "SearchParameter", "requirements", element.getRequirementsElement(), -1);
if (element.hasCodeElement())
composeCode(t, "SearchParameter", "code", element.getCodeElement(), -1);
if (element.hasBaseElement())
composeCode(t, "SearchParameter", "base", element.getBaseElement(), -1);
if (element.hasTypeElement())
composeEnum(t, "SearchParameter", "type", element.getTypeElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "SearchParameter", "description", element.getDescriptionElement(), -1);
if (element.hasExpressionElement())
composeString(t, "SearchParameter", "expression", element.getExpressionElement(), -1);
if (element.hasXpathElement())
composeString(t, "SearchParameter", "xpath", element.getXpathElement(), -1);
if (element.hasXpathUsageElement())
composeEnum(t, "SearchParameter", "xpathUsage", element.getXpathUsageElement(), -1);
for (int i = 0; i < element.getTarget().size(); i++) composeCode(t, "SearchParameter", "target", element.getTarget().get(i), i);
}
use of org.hl7.fhir.dstu2016may.model.Base in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method convertToString.
/**
* worker routine for converting a set of objects to a string representation
*
* @param items - result from @evaluate
* @return
*/
public String convertToString(List<Base> items) {
StringBuilder b = new StringBuilder();
boolean first = true;
for (Base item : items) {
if (first)
first = false;
else
b.append(',');
b.append(convertToString(item));
}
return b.toString();
}
Aggregations