Search in sources :

Example 91 with Base

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);
}
Also used : ExpressionNode(org.hl7.fhir.dstu2.model.ExpressionNode) ArrayList(java.util.ArrayList) Base(org.hl7.fhir.dstu2.model.Base)

Example 92 with Base

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();
}
Also used : IPrimitiveType(org.hl7.fhir.instance.model.api.IPrimitiveType) EqualsBuilder(org.apache.commons.lang3.builder.EqualsBuilder)

Example 93 with Base

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);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 94 with Base

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);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 95 with Base

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();
}
Also used : ParserBase(org.hl7.fhir.dstu2016may.metamodel.ParserBase) Base(org.hl7.fhir.dstu2016may.model.Base)

Aggregations

ArrayList (java.util.ArrayList)324 FHIRException (org.hl7.fhir.exceptions.FHIRException)177 Base (org.hl7.fhir.r4b.model.Base)87 Base (org.hl7.fhir.r5.model.Base)87 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)76 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)70 ValidationMessage (org.hl7.fhir.utilities.validation.ValidationMessage)66 PathEngineException (org.hl7.fhir.exceptions.PathEngineException)64 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)55 NotImplementedException (org.apache.commons.lang3.NotImplementedException)47 Base (org.hl7.fhir.dstu2016may.model.Base)47 UcumException (org.fhir.ucum.UcumException)43 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)41 Base (org.hl7.fhir.dstu2.model.Base)40 BigDecimal (java.math.BigDecimal)39 IOException (java.io.IOException)37 ParserBase (org.hl7.fhir.dstu2016may.metamodel.ParserBase)34 FileOutputStream (java.io.FileOutputStream)29 ElementDefinition (org.hl7.fhir.dstu3.model.ElementDefinition)28 StructureDefinition (org.hl7.fhir.dstu3.model.StructureDefinition)28