Search in sources :

Example 16 with CanonicalType

use of org.hl7.fhir.r5.model.CanonicalType in project org.hl7.fhir.core by hapifhir.

the class ElementDefinition30_50 method convertTypeRefComponent.

public static void convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src, List<ElementDefinition.TypeRefComponent> list) throws FHIRException {
    if (src == null)
        return;
    ElementDefinition.TypeRefComponent tgt = null;
    for (ElementDefinition.TypeRefComponent t : list) if (t.getCode().equals(src.getCode()))
        tgt = t;
    if (tgt == null) {
        tgt = new ElementDefinition.TypeRefComponent();
        list.add(tgt);
        ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
        tgt.setCodeElement(Uri30_50.convertUri(src.getCodeElement()));
    }
    if (src.hasProfile()) {
        boolean found = false;
        for (CanonicalType p : tgt.getProfile()) {
            if (p.equals(src.getProfile()))
                found = true;
        }
        if (!found)
            tgt.addProfile(src.getProfile());
    }
    if (src.hasTargetProfile())
        tgt.addTargetProfile(src.getTargetProfile());
    for (org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode> t : src.getAggregation()) {
        org.hl7.fhir.r5.model.Enumeration<ElementDefinition.AggregationMode> a = convertAggregationMode(t);
        if (!tgt.hasAggregation(a.getValue()))
            ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(t, tgt.addAggregation(a.getValue()));
    }
    if (src.hasVersioning())
        tgt.setVersioningElement(convertReferenceVersionRules(src.getVersioningElement()));
}
Also used : ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) CanonicalType(org.hl7.fhir.r5.model.CanonicalType)

Example 17 with CanonicalType

use of org.hl7.fhir.r5.model.CanonicalType in project org.hl7.fhir.core by hapifhir.

the class Canonical10_40 method convertReferenceToCanonical.

public static CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException {
    CanonicalType dst = new CanonicalType(src.getReference());
    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, dst);
    return dst;
}
Also used : CanonicalType(org.hl7.fhir.r4.model.CanonicalType)

Example 18 with CanonicalType

use of org.hl7.fhir.r5.model.CanonicalType in project org.hl7.fhir.core by hapifhir.

the class Reference14_40 method convertCanonicalToReference.

public static Reference convertCanonicalToReference(CanonicalType src) throws FHIRException {
    Reference dst = new Reference(src.getValue());
    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, dst);
    return dst;
}
Also used : Reference(org.hl7.fhir.dstu2016may.model.Reference)

Example 19 with CanonicalType

use of org.hl7.fhir.r5.model.CanonicalType in project org.hl7.fhir.core by hapifhir.

the class Reference14_40 method convertReferenceToCanonical.

public static CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException {
    CanonicalType dst = new CanonicalType(src.getReference());
    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, dst);
    return dst;
}
Also used : CanonicalType(org.hl7.fhir.r4.model.CanonicalType)

Example 20 with CanonicalType

use of org.hl7.fhir.r5.model.CanonicalType in project org.hl7.fhir.core by hapifhir.

the class Reference14_50 method convertReferenceToCanonical.

public static CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException {
    CanonicalType dst = new CanonicalType(src.getReference());
    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, dst);
    return dst;
}
Also used : CanonicalType(org.hl7.fhir.r5.model.CanonicalType)

Aggregations

CanonicalType (org.hl7.fhir.r4.model.CanonicalType)45 CanonicalType (org.hl7.fhir.r5.model.CanonicalType)37 ArrayList (java.util.ArrayList)27 CanonicalType (org.hl7.fhir.r4b.model.CanonicalType)19 TypeRefComponent (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent)14 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)13 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)12 Test (org.junit.jupiter.api.Test)12 List (java.util.List)10 FHIRException (org.hl7.fhir.exceptions.FHIRException)9 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)9 HashMap (java.util.HashMap)7 HashSet (java.util.HashSet)7 Extension (org.hl7.fhir.r4.model.Extension)7 Library (org.hl7.fhir.r4.model.Library)7 StringType (org.hl7.fhir.r4.model.StringType)6 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)6 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)5 Bundle (org.hl7.fhir.r4.model.Bundle)5 IdType (org.hl7.fhir.r4.model.IdType)5