Search in sources :

Example 1 with IntegerType

use of org.hl7.fhir.r4.model.IntegerType in project bunsen by cerner.

the class TestData method newPatient.

/**
 * Returns a FHIR Patient for testing purposes.
 */
public static Patient newPatient() {
    Patient patient = new Patient();
    patient.setId("test-patient");
    patient.setMultipleBirth(new IntegerType(1));
    return patient;
}
Also used : IntegerType(org.hl7.fhir.dstu3.model.IntegerType) Patient(org.hl7.fhir.dstu3.model.Patient)

Example 2 with IntegerType

use of org.hl7.fhir.r4.model.IntegerType in project kindling by HL7.

the class SpreadSheetReloader method parseStatus.

private void parseStatus(DomainResource ed, String value) {
    ed.getExtension().removeIf(ext -> ext.getUrl().equals(BuildExtensions.EXT_FMM_LEVEL));
    ed.getExtension().removeIf(ext -> ext.getUrl().equals(BuildExtensions.EXT_STANDARDS_STATUS));
    ed.getExtension().removeIf(ext -> ext.getUrl().equals(BuildExtensions.EXT_NORMATIVE_VERSION));
    if (!Utilities.noString(value) && value.contains("/")) {
        String[] p = value.split("\\/");
        if (Utilities.noString(p[0].trim())) {
            ed.getExtension().removeIf(ext -> ext.getUrl().equals(BuildExtensions.EXT_FMM_LEVEL));
        } else {
            ed.addExtension(BuildExtensions.EXT_FMM_LEVEL, new IntegerType(p[0]));
        }
        if (p[1].contains(";")) {
            ed.addExtension(BuildExtensions.EXT_STANDARDS_STATUS, new CodeType(p[1].substring(0, p[1].indexOf(";"))));
            ed.addExtension(BuildExtensions.EXT_NORMATIVE_VERSION, new CodeType(p[1].substring(p[1].indexOf("from=") + 5)));
        } else {
            ed.addExtension(BuildExtensions.EXT_STANDARDS_STATUS, new CodeType(p[1]));
        }
    }
    sortExtensions(ed);
}
Also used : IntegerType(org.hl7.fhir.r5.model.IntegerType) CodeType(org.hl7.fhir.r5.model.CodeType)

Example 3 with IntegerType

use of org.hl7.fhir.r4.model.IntegerType in project kindling by HL7.

the class Regenerator method generateOperation.

private void generateOperation(String root, ResourceDefn r, Operation op) throws IOException {
    OperationDefinition opd = op.getResource().copy();
    opd.setId(r.getName() + "-" + op.getName());
    opd.setUrl("http://hl7.org/fhir/build/OperationDefinition/" + opd.getId());
    if (!Utilities.noString(op.getFooter())) {
        opd.addExtension(BuildExtensions.EXT_FOOTER, new MarkdownType(op.getFooter()));
    }
    if (!Utilities.noString(op.getFooter2())) {
        opd.addExtension(BuildExtensions.EXT_FOOTER2, new MarkdownType(op.getFooter2()));
    }
    for (OperationExample opex : op.getExamples()) {
        Extension ex = new Extension(BuildExtensions.EXT_OP_EXAMPLE);
        if (!Utilities.noString(opex.getContent())) {
            ex.addExtension(BuildExtensions.EXT_OP_EXAMPLE_CONTENT, new StringType(opex.getContent()));
        }
        if (!Utilities.noString(opex.getComment())) {
            ex.addExtension(BuildExtensions.EXT_OP_EXAMPLE_COMMENT, new StringType(opex.getComment()));
        }
        ex.addExtension(BuildExtensions.EXT_OP_EXAMPLE_RESPONSE, new BooleanType(opex.isResponse()));
        ex.addExtension(BuildExtensions.EXT_OP_EXAMPLE_LIST, new IntegerType(1));
        opd.addExtension(ex);
    }
    for (OperationExample opex : op.getExamples2()) {
        Extension ex = new Extension(BuildExtensions.EXT_OP_EXAMPLE);
        if (!Utilities.noString(opex.getContent())) {
            ex.addExtension(BuildExtensions.EXT_OP_EXAMPLE_CONTENT, new StringType(opex.getContent()));
        }
        if (!Utilities.noString(opex.getComment())) {
            ex.addExtension(BuildExtensions.EXT_OP_EXAMPLE_COMMENT, new StringType(opex.getComment()));
        }
        ex.addExtension(BuildExtensions.EXT_OP_EXAMPLE_RESPONSE, new BooleanType(opex.isResponse()));
        ex.addExtension(BuildExtensions.EXT_OP_EXAMPLE_LIST, new IntegerType(2));
        opd.addExtension(ex);
    }
    File fn = new File(Utilities.path(root, opd.fhirType().toLowerCase() + "-" + opd.getId() + ".gen.xml"));
    new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), opd);
    fn.setLastModified(r.getTimestamp());
}
Also used : Extension(org.hl7.fhir.r5.model.Extension) IntegerType(org.hl7.fhir.r5.model.IntegerType) XmlParser(org.hl7.fhir.r5.formats.XmlParser) OperationExample(org.hl7.fhir.definitions.model.Operation.OperationExample) StringType(org.hl7.fhir.r5.model.StringType) FileOutputStream(java.io.FileOutputStream) BooleanType(org.hl7.fhir.r5.model.BooleanType) MarkdownType(org.hl7.fhir.r5.model.MarkdownType) OperationDefinition(org.hl7.fhir.r5.model.OperationDefinition) File(java.io.File)

Example 4 with IntegerType

use of org.hl7.fhir.r4.model.IntegerType in project kindling by HL7.

the class ProfileGenerator method addSpecificDetails.

private void addSpecificDetails(PrimitiveType type, ElementDefinition ed) throws FHIRFormatError {
    if (type.getCode().equals("integer")) {
        ed.setMinValue(new IntegerType(-2147483648));
        ed.setMaxValue(new IntegerType(2147483647));
    }
    if (type.getCode().equals("integer64")) {
        ed.setMinValue(new Integer64Type(-9223372036854775808L));
        ed.setMaxValue(new Integer64Type(9223372036854775807L));
    }
    if (type.getCode().equals("string")) {
        ed.setMaxLength(1024 * 1024);
    }
}
Also used : IntegerType(org.hl7.fhir.r5.model.IntegerType) Integer64Type(org.hl7.fhir.r5.model.Integer64Type)

Example 5 with IntegerType

use of org.hl7.fhir.r4.model.IntegerType in project bunsen by cerner.

the class TestData method newPatient.

/**
 * Returns a FHIR Patient for testing purposes.
 */
public static Patient newPatient() {
    Patient patient = new Patient();
    patient.setId("test-patient");
    patient.setMultipleBirth(new IntegerType(1));
    return patient;
}
Also used : IntegerType(org.hl7.fhir.dstu3.model.IntegerType) Patient(org.hl7.fhir.dstu3.model.Patient)

Aggregations

ArrayList (java.util.ArrayList)51 BigDecimal (java.math.BigDecimal)34 PathEngineException (org.hl7.fhir.exceptions.PathEngineException)28 IntegerType (org.hl7.fhir.r5.model.IntegerType)26 IntegerType (org.hl7.fhir.r4.model.IntegerType)23 IntegerType (org.hl7.fhir.r4b.model.IntegerType)23 UcumException (org.fhir.ucum.UcumException)19 Test (org.junit.jupiter.api.Test)13 Decimal (org.fhir.ucum.Decimal)12 FHIRException (org.hl7.fhir.exceptions.FHIRException)12 Base (org.hl7.fhir.r4b.model.Base)11 Base (org.hl7.fhir.r5.model.Base)11 IntegerType (org.hl7.fhir.dstu2.model.IntegerType)10 IntegerType (org.hl7.fhir.dstu2016may.model.IntegerType)10 StringType (org.hl7.fhir.r4.model.StringType)10 Patient (org.hl7.fhir.r4.model.Patient)9 Map (java.util.Map)7 DecimalType (org.hl7.fhir.r5.model.DecimalType)7 List (java.util.List)6 IntegerType (org.hl7.fhir.dstu3.model.IntegerType)6