Search in sources :

Example 76 with StringType

use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.

the class VersionConvertorPrimitiveType10_30Test method testNullValueDstu2Primitive.

@ParameterizedTest(name = "Testing dstu2 -> dstu3 conversion of null value {0}.")
@MethodSource("dstu2PrimitiveTypes")
public <T extends PrimitiveType> void testNullValueDstu2Primitive(String classname, T obj) {
    obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value"));
    Assertions.assertNull(((org.hl7.fhir.dstu3.model.PrimitiveType) VersionConvertorFactory_10_30.convertType(obj)).getValue());
}
Also used : StringType(org.hl7.fhir.dstu2.model.StringType) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 77 with StringType

use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.

the class VersionConvertorPrimitiveType10_50Test method testNullValueDstu2Primitive.

@ParameterizedTest(name = "Testing dstu2 -> r5 conversion of null value {0}.")
@MethodSource("dstu2PrimitiveTypes")
public <T extends PrimitiveType> void testNullValueDstu2Primitive(String classname, T obj) {
    obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value"));
    Assertions.assertNull(((org.hl7.fhir.r4.model.PrimitiveType) VersionConvertorFactory_10_40.convertType(obj)).getValue());
}
Also used : StringType(org.hl7.fhir.dstu2.model.StringType) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 78 with StringType

use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.

the class VersionConvertorPrimitiveType30_40Test method testNullValueDstu2Primitive.

@ParameterizedTest(name = "Testing dstu3 -> r4 conversion of null value {0}.")
@MethodSource("dstu3PrimitiveTypes")
public <T extends PrimitiveType> void testNullValueDstu2Primitive(String classname, T obj) {
    obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value"));
    Assertions.assertNull(((org.hl7.fhir.r4.model.PrimitiveType) VersionConvertorFactory_30_40.convertType(obj)).getValue());
}
Also used : StringType(org.hl7.fhir.dstu3.model.StringType) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 79 with StringType

use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.

the class ExpressionAdvisor50 method handleExtension.

public void handleExtension(@Nonnull String path, @Nonnull org.hl7.fhir.r5.model.Extension src, @Nonnull org.hl7.fhir.dstu2.model.Extension tgt) {
    if (src.getValue() instanceof org.hl7.fhir.r5.model.Expression) {
        StringType type = new StringType();
        if (src.getValue() == null) {
            throw new NullPointerException("null cannot be cast to non-null type org.hl7.fhir.r5.model.Expression");
        } else {
            type.setValueAsString(((Expression) src.getValue()).getExpression());
            tgt.setValue(type);
            if (src.hasUrlElement()) {
                tgt.setUrlElement(Uri10_50.convertUri(src.getUrlElement()));
            }
        }
    } else {
        throw new FHIRException("Unknown extension type passed in to custom convertor method.");
    }
}
Also used : Expression(org.hl7.fhir.r5.model.Expression) StringType(org.hl7.fhir.dstu2.model.StringType) FHIRException(org.hl7.fhir.exceptions.FHIRException)

Example 80 with StringType

use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method displayHumanName.

public static String displayHumanName(HumanName name) {
    StringBuilder s = new StringBuilder();
    if (name.hasText())
        s.append(name.getText());
    else {
        for (StringType p : name.getGiven()) {
            s.append(p.getValue());
            s.append(" ");
        }
        for (StringType p : name.getFamily()) {
            s.append(p.getValue());
            s.append(" ");
        }
    }
    if (name.hasUse() && name.getUse() != NameUse.USUAL)
        s.append("(" + name.getUse().toString() + ")");
    return s.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) StringType(org.hl7.fhir.dstu2.model.StringType)

Aggregations

StringType (org.hl7.fhir.r4.model.StringType)158 ArrayList (java.util.ArrayList)77 Test (org.junit.jupiter.api.Test)77 StringType (org.hl7.fhir.dstu3.model.StringType)65 Parameters (org.hl7.fhir.r4.model.Parameters)62 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)62 StringType (org.hl7.fhir.r5.model.StringType)61 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)58 StringType (org.hl7.fhir.r4b.model.StringType)45 FHIRException (org.hl7.fhir.exceptions.FHIRException)43 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)42 HashMap (java.util.HashMap)28 StringType (org.hl7.fhir.dstu2.model.StringType)27 StringType (org.hl7.fhir.dstu2016may.model.StringType)26 Coding (org.hl7.fhir.r4.model.Coding)26 Extension (org.hl7.fhir.r4.model.Extension)25 Measure (org.hl7.fhir.r4.model.Measure)23 Test (org.junit.Test)23 Base (org.hl7.fhir.r5.model.Base)20 NotImplementedException (org.apache.commons.lang3.NotImplementedException)19