Search in sources :

Example 26 with Annotation

use of org.hl7.cql_annotations.r1.Annotation in project org.hl7.fhir.core by hapifhir.

the class JsonParser method composeType.

protected void composeType(String prefix, Type type) throws IOException {
    if (type == null)
        ;
    else if (type instanceof Age)
        composeAge(prefix + "Age", (Age) type);
    else if (type instanceof Count)
        composeCount(prefix + "Count", (Count) type);
    else if (type instanceof Money)
        composeMoney(prefix + "Money", (Money) type);
    else if (type instanceof Distance)
        composeDistance(prefix + "Distance", (Distance) type);
    else if (type instanceof Duration)
        composeDuration(prefix + "Duration", (Duration) type);
    else if (type instanceof SimpleQuantity)
        composeSimpleQuantity(prefix + "SimpleQuantity", (SimpleQuantity) type);
    else if (type instanceof Period)
        composePeriod(prefix + "Period", (Period) type);
    else if (type instanceof Coding)
        composeCoding(prefix + "Coding", (Coding) type);
    else if (type instanceof Range)
        composeRange(prefix + "Range", (Range) type);
    else if (type instanceof Quantity)
        composeQuantity(prefix + "Quantity", (Quantity) type);
    else if (type instanceof Attachment)
        composeAttachment(prefix + "Attachment", (Attachment) type);
    else if (type instanceof Ratio)
        composeRatio(prefix + "Ratio", (Ratio) type);
    else if (type instanceof Annotation)
        composeAnnotation(prefix + "Annotation", (Annotation) type);
    else if (type instanceof SampledData)
        composeSampledData(prefix + "SampledData", (SampledData) type);
    else if (type instanceof Reference)
        composeReference(prefix + "Reference", (Reference) type);
    else if (type instanceof CodeableConcept)
        composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) type);
    else if (type instanceof Identifier)
        composeIdentifier(prefix + "Identifier", (Identifier) type);
    else if (type instanceof Signature)
        composeSignature(prefix + "Signature", (Signature) type);
    else if (type instanceof TriggerDefinition)
        composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) type);
    else if (type instanceof ElementDefinition)
        composeElementDefinition(prefix + "ElementDefinition", (ElementDefinition) type);
    else if (type instanceof Timing)
        composeTiming(prefix + "Timing", (Timing) type);
    else if (type instanceof ModuleMetadata)
        composeModuleMetadata(prefix + "ModuleMetadata", (ModuleMetadata) type);
    else if (type instanceof ActionDefinition)
        composeActionDefinition(prefix + "ActionDefinition", (ActionDefinition) type);
    else if (type instanceof Address)
        composeAddress(prefix + "Address", (Address) type);
    else if (type instanceof HumanName)
        composeHumanName(prefix + "HumanName", (HumanName) type);
    else if (type instanceof DataRequirement)
        composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
    else if (type instanceof Meta)
        composeMeta(prefix + "Meta", (Meta) type);
    else if (type instanceof ParameterDefinition)
        composeParameterDefinition(prefix + "ParameterDefinition", (ParameterDefinition) type);
    else if (type instanceof ContactPoint)
        composeContactPoint(prefix + "ContactPoint", (ContactPoint) type);
    else if (type instanceof MarkdownType) {
        composeMarkdownCore(prefix + "Markdown", (MarkdownType) type, false);
        composeMarkdownExtras(prefix + "Markdown", (MarkdownType) type, false);
    } else if (type instanceof UnsignedIntType) {
        composeUnsignedIntCore(prefix + "UnsignedInt", (UnsignedIntType) type, false);
        composeUnsignedIntExtras(prefix + "UnsignedInt", (UnsignedIntType) type, false);
    } else if (type instanceof CodeType) {
        composeCodeCore(prefix + "Code", (CodeType) type, false);
        composeCodeExtras(prefix + "Code", (CodeType) type, false);
    } else if (type instanceof IdType) {
        composeIdCore(prefix + "Id", (IdType) type, false);
        composeIdExtras(prefix + "Id", (IdType) type, false);
    } else if (type instanceof OidType) {
        composeOidCore(prefix + "Oid", (OidType) type, false);
        composeOidExtras(prefix + "Oid", (OidType) type, false);
    } else if (type instanceof PositiveIntType) {
        composePositiveIntCore(prefix + "PositiveInt", (PositiveIntType) type, false);
        composePositiveIntExtras(prefix + "PositiveInt", (PositiveIntType) type, false);
    } else if (type instanceof UuidType) {
        composeUuidCore(prefix + "Uuid", (UuidType) type, false);
        composeUuidExtras(prefix + "Uuid", (UuidType) type, false);
    } else if (type instanceof IntegerType) {
        composeIntegerCore(prefix + "Integer", (IntegerType) type, false);
        composeIntegerExtras(prefix + "Integer", (IntegerType) type, false);
    } else if (type instanceof DateTimeType) {
        composeDateTimeCore(prefix + "DateTime", (DateTimeType) type, false);
        composeDateTimeExtras(prefix + "DateTime", (DateTimeType) type, false);
    } else if (type instanceof DateType) {
        composeDateCore(prefix + "Date", (DateType) type, false);
        composeDateExtras(prefix + "Date", (DateType) type, false);
    } else if (type instanceof DecimalType) {
        composeDecimalCore(prefix + "Decimal", (DecimalType) type, false);
        composeDecimalExtras(prefix + "Decimal", (DecimalType) type, false);
    } else if (type instanceof UriType) {
        composeUriCore(prefix + "Uri", (UriType) type, false);
        composeUriExtras(prefix + "Uri", (UriType) type, false);
    } else if (type instanceof Base64BinaryType) {
        composeBase64BinaryCore(prefix + "Base64Binary", (Base64BinaryType) type, false);
        composeBase64BinaryExtras(prefix + "Base64Binary", (Base64BinaryType) type, false);
    } else if (type instanceof TimeType) {
        composeTimeCore(prefix + "Time", (TimeType) type, false);
        composeTimeExtras(prefix + "Time", (TimeType) type, false);
    } else if (type instanceof StringType) {
        composeStringCore(prefix + "String", (StringType) type, false);
        composeStringExtras(prefix + "String", (StringType) type, false);
    } else if (type instanceof BooleanType) {
        composeBooleanCore(prefix + "Boolean", (BooleanType) type, false);
        composeBooleanExtras(prefix + "Boolean", (BooleanType) type, false);
    } else if (type instanceof InstantType) {
        composeInstantCore(prefix + "Instant", (InstantType) type, false);
        composeInstantExtras(prefix + "Instant", (InstantType) type, false);
    } else
        throw new Error("Unhandled type");
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Example 27 with Annotation

use of org.hl7.cql_annotations.r1.Annotation in project org.hl7.fhir.core by hapifhir.

the class FamilyMemberHistory method setProperty.

@Override
public void setProperty(String name, Base value) throws FHIRException {
    if (name.equals("identifier"))
        this.getIdentifier().add(castToIdentifier(value));
    else if (name.equals("patient"))
        // Reference
        this.patient = castToReference(value);
    else if (name.equals("date"))
        // DateTimeType
        this.date = castToDateTime(value);
    else if (name.equals("status"))
        // Enumeration<FamilyHistoryStatus>
        this.status = new FamilyHistoryStatusEnumFactory().fromType(value);
    else if (name.equals("name"))
        // StringType
        this.name = castToString(value);
    else if (name.equals("relationship"))
        // CodeableConcept
        this.relationship = castToCodeableConcept(value);
    else if (name.equals("gender"))
        // Enumeration<AdministrativeGender>
        this.gender = new AdministrativeGenderEnumFactory().fromType(value);
    else if (name.equals("born[x]"))
        // Type
        this.born = (Type) value;
    else if (name.equals("age[x]"))
        // Type
        this.age = (Type) value;
    else if (name.equals("deceased[x]"))
        // Type
        this.deceased = (Type) value;
    else if (name.equals("note"))
        // Annotation
        this.note = castToAnnotation(value);
    else if (name.equals("condition"))
        this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
    else
        super.setProperty(name, value);
}
Also used : AdministrativeGenderEnumFactory(org.hl7.fhir.dstu2016may.model.Enumerations.AdministrativeGenderEnumFactory)

Example 28 with Annotation

use of org.hl7.cql_annotations.r1.Annotation in project org.hl7.fhir.core by hapifhir.

the class DeviceUseStatement10_40 method convertDeviceUseStatement.

public static org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r4.model.DeviceUseStatement src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement();
    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
    if (src.hasBodySite())
        tgt.setBodySite(ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getBodySite()));
    if (src.hasDevice())
        tgt.setDevice(Reference10_40.convertReference(src.getDevice()));
    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier10_40.convertIdentifier(t));
    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addIndication(CodeableConcept10_40.convertCodeableConcept(t));
    for (Annotation t : src.getNote()) tgt.addNotes(t.getText());
    if (src.hasRecordedOnElement())
        tgt.setRecordedOnElement(DateTime10_40.convertDateTime(src.getRecordedOnElement()));
    if (src.hasSubject())
        tgt.setSubject(Reference10_40.convertReference(src.getSubject()));
    if (src.hasTiming())
        tgt.setTiming(ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getTiming()));
    return tgt;
}
Also used : Annotation(org.hl7.fhir.r4.model.Annotation)

Example 29 with Annotation

use of org.hl7.cql_annotations.r1.Annotation in project org.hl7.fhir.core by hapifhir.

the class JavaResourceGenerator method writeAttributeAnnotation.

private void writeAttributeAnnotation(String indent, ElementDefinition e, int order, String tn, String rn, StructureDefinition structure) throws Exception {
    String elementName = getElementName(e.getName(), true);
    if (elementName.endsWith("_")) {
        // The annotation doesn't need trailing _
        elementName = elementName.substring(0, elementName.length() - 1);
    }
    StringBuilder childB = new StringBuilder();
    childB.append(indent);
    childB.append("@Child(name = \"");
    childB.append(elementName);
    childB.append("\", type = {");
    childB.append(getTypeClassList(e, tn, structure));
    childB.append("}, order=");
    childB.append(Integer.toString(order));
    childB.append(", min=");
    childB.append(Integer.toString(e.getMin()));
    childB.append(", max=");
    childB.append((e.getMax().equals("*") ? "Child.MAX_UNLIMITED" : e.getMax().toString()));
    childB.append(", modifier=");
    childB.append(e.getIsModifier());
    childB.append(", summary=");
    childB.append(e.getIsSummary());
    childB.append(")\r\n");
    write(childB.toString());
    write(indent + "@Description(shortDefinition=\"" + Utilities.escapeJava(replaceTitle(rn, e.getShort())) + "\", formalDefinition=\"" + Utilities.escapeJava(replaceTitle(rn, e.getDefinition())) + "\" )\r\n");
    if (e.getBinding() != null) {
        if (e.getBinding().getValueSet() != null && !Utilities.noString(e.getBinding().getValueSet())) {
            write(indent + "@ca.uhn.fhir.model.api.annotation.Binding(valueSet=\"" + noVer(e.getBinding().getValueSet()) + "\")\r\n");
        }
    }
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 30 with Annotation

use of org.hl7.cql_annotations.r1.Annotation in project org.hl7.fhir.core by hapifhir.

the class FamilyMemberHistory method setProperty.

@Override
public void setProperty(String name, Base value) throws FHIRException {
    if (name.equals("identifier"))
        this.getIdentifier().add(castToIdentifier(value));
    else if (name.equals("patient"))
        // Reference
        this.patient = castToReference(value);
    else if (name.equals("date"))
        // DateTimeType
        this.date = castToDateTime(value);
    else if (name.equals("status"))
        // Enumeration<FamilyHistoryStatus>
        this.status = new FamilyHistoryStatusEnumFactory().fromType(value);
    else if (name.equals("name"))
        // StringType
        this.name = castToString(value);
    else if (name.equals("relationship"))
        // CodeableConcept
        this.relationship = castToCodeableConcept(value);
    else if (name.equals("gender"))
        // Enumeration<AdministrativeGender>
        this.gender = new AdministrativeGenderEnumFactory().fromType(value);
    else if (name.equals("born[x]"))
        // Type
        this.born = (Type) value;
    else if (name.equals("age[x]"))
        // Type
        this.age = (Type) value;
    else if (name.equals("deceased[x]"))
        // Type
        this.deceased = (Type) value;
    else if (name.equals("note"))
        // Annotation
        this.note = castToAnnotation(value);
    else if (name.equals("condition"))
        this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
    else
        super.setProperty(name, value);
}
Also used : AdministrativeGenderEnumFactory(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGenderEnumFactory)

Aggregations

NotImplementedException (org.apache.commons.lang3.NotImplementedException)14 Annotation (zipkin2.Annotation)14 Trace (com.newrelic.api.agent.Trace)13 Operation (gov.cms.bfd.server.war.Operation)13 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)12 Annotation (org.hl7.fhir.r4.model.Annotation)12 Map (java.util.Map)11 NoResultException (javax.persistence.NoResultException)11 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)10 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)9 Annotation (org.hl7.fhir.dstu3.model.Annotation)9 Search (ca.uhn.fhir.rest.annotation.Search)8 List (java.util.List)8 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)8 Read (ca.uhn.fhir.rest.annotation.Read)7 Patient (org.hl7.fhir.dstu3.model.Patient)7 OffsetLinkBuilder (gov.cms.bfd.server.war.commons.OffsetLinkBuilder)6 Collectors (java.util.stream.Collectors)6 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)6