Search in sources :

Example 1 with SearchParamType

use of org.hl7.fhir.r4b.model.Enumerations.SearchParamType in project kindling by HL7.

the class Publisher method makeSearchParam.

private CapabilityStatementRestResourceSearchParamComponent makeSearchParam(String name, SearchParamType type, String id, String doco) throws Exception {
    CapabilityStatementRestResourceSearchParamComponent result = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
    result.setName(name);
    result.setDefinition("http://hl7.org/fhir/SearchParameter/" + id);
    result.setType(type);
    result.setDocumentation(doco);
    return result;
}
Also used : CapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent)

Example 2 with SearchParamType

use of org.hl7.fhir.r4b.model.Enumerations.SearchParamType in project org.hl7.fhir.core by hapifhir.

the class SearchParameter method setProperty.

@Override
public Base setProperty(String name, Base value) throws FHIRException {
    if (name.equals("url")) {
        // UriType
        this.url = castToUri(value);
    } else if (name.equals("version")) {
        // StringType
        this.version = castToString(value);
    } else if (name.equals("name")) {
        // StringType
        this.name = castToString(value);
    } else if (name.equals("status")) {
        value = new PublicationStatusEnumFactory().fromType(castToCode(value));
        // Enumeration<PublicationStatus>
        this.status = (Enumeration) value;
    } else if (name.equals("experimental")) {
        // BooleanType
        this.experimental = castToBoolean(value);
    } else if (name.equals("date")) {
        // DateTimeType
        this.date = castToDateTime(value);
    } else if (name.equals("publisher")) {
        // StringType
        this.publisher = castToString(value);
    } else if (name.equals("contact")) {
        this.getContact().add(castToContactDetail(value));
    } else if (name.equals("useContext")) {
        this.getUseContext().add(castToUsageContext(value));
    } else if (name.equals("jurisdiction")) {
        this.getJurisdiction().add(castToCodeableConcept(value));
    } else if (name.equals("purpose")) {
        // MarkdownType
        this.purpose = castToMarkdown(value);
    } else if (name.equals("code")) {
        // CodeType
        this.code = castToCode(value);
    } else if (name.equals("base")) {
        this.getBase().add(castToCode(value));
    } else if (name.equals("type")) {
        value = new SearchParamTypeEnumFactory().fromType(castToCode(value));
        // Enumeration<SearchParamType>
        this.type = (Enumeration) value;
    } else if (name.equals("derivedFrom")) {
        // UriType
        this.derivedFrom = castToUri(value);
    } else if (name.equals("description")) {
        // MarkdownType
        this.description = castToMarkdown(value);
    } else if (name.equals("expression")) {
        // StringType
        this.expression = castToString(value);
    } else if (name.equals("xpath")) {
        // StringType
        this.xpath = castToString(value);
    } else if (name.equals("xpathUsage")) {
        value = new XPathUsageTypeEnumFactory().fromType(castToCode(value));
        // Enumeration<XPathUsageType>
        this.xpathUsage = (Enumeration) value;
    } else if (name.equals("target")) {
        this.getTarget().add(castToCode(value));
    } else if (name.equals("comparator")) {
        value = new SearchComparatorEnumFactory().fromType(castToCode(value));
        this.getComparator().add((Enumeration) value);
    } else if (name.equals("modifier")) {
        value = new SearchModifierCodeEnumFactory().fromType(castToCode(value));
        this.getModifier().add((Enumeration) value);
    } else if (name.equals("chain")) {
        this.getChain().add(castToString(value));
    } else if (name.equals("component")) {
        this.getComponent().add((SearchParameterComponentComponent) value);
    } else
        return super.setProperty(name, value);
    return value;
}
Also used : PublicationStatusEnumFactory(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatusEnumFactory) SearchParamTypeEnumFactory(org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory)

Example 3 with SearchParamType

use of org.hl7.fhir.r4b.model.Enumerations.SearchParamType in project org.hl7.fhir.core by hapifhir.

the class GraphQLSchemaGenerator method generateTypes.

public void generateTypes(OutputStream stream) throws IOException, FHIRException {
    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream));
    Map<String, StructureDefinition> pl = new HashMap<String, StructureDefinition>();
    Map<String, StructureDefinition> tl = new HashMap<String, StructureDefinition>();
    for (StructureDefinition sd : context.allStructures()) {
        if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
            pl.put(sd.getName(), sd);
        }
        if (sd.getKind() == StructureDefinitionKind.COMPLEXTYPE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
            tl.put(sd.getName(), sd);
        }
    }
    writer.write("# FHIR GraphQL Schema. Version " + version + "\r\n\r\n");
    writer.write("# FHIR Defined Primitive types\r\n");
    for (String n : sorted(pl.keySet())) generatePrimitive(writer, pl.get(n));
    writer.write("\r\n");
    writer.write("# FHIR Defined Search Parameter Types\r\n");
    for (SearchParamType dir : SearchParamType.values()) {
        if (dir != SearchParamType.NULL)
            generateSearchParamType(writer, dir.toCode());
    }
    writer.write("\r\n");
    generateElementBase(writer);
    for (String n : sorted(tl.keySet())) generateType(writer, tl.get(n));
    writer.flush();
    writer.close();
}
Also used : StructureDefinition(org.hl7.fhir.r4b.model.StructureDefinition) HashMap(java.util.HashMap) OutputStreamWriter(java.io.OutputStreamWriter) SearchParamType(org.hl7.fhir.r4b.model.Enumerations.SearchParamType) BufferedWriter(java.io.BufferedWriter)

Example 4 with SearchParamType

use of org.hl7.fhir.r4b.model.Enumerations.SearchParamType in project org.hl7.fhir.core by hapifhir.

the class GraphQLSchemaGenerator method generateTypes.

public void generateTypes(OutputStream stream) throws IOException, FHIRException {
    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream));
    Map<String, StructureDefinition> pl = new HashMap<String, StructureDefinition>();
    Map<String, StructureDefinition> tl = new HashMap<String, StructureDefinition>();
    for (StructureDefinition sd : context.allStructures()) {
        if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
            pl.put(sd.getName(), sd);
        }
        if (sd.getKind() == StructureDefinitionKind.COMPLEXTYPE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
            tl.put(sd.getName(), sd);
        }
    }
    writer.write("# FHIR GraphQL Schema. Version " + Constants.VERSION + "\r\n\r\n");
    writer.write("# FHIR Defined Primitive types\r\n");
    for (String n : sorted(pl.keySet())) generatePrimitive(writer, pl.get(n));
    writer.write("\r\n");
    writer.write("# FHIR Defined Search Parameter Types\r\n");
    for (SearchParamType dir : SearchParamType.values()) {
        if (dir != SearchParamType.NULL)
            generateSearchParamType(writer, dir.toCode());
    }
    writer.write("\r\n");
    generateElementBase(writer);
    for (String n : sorted(tl.keySet())) generateType(writer, tl.get(n));
    writer.flush();
    writer.close();
}
Also used : StructureDefinition(org.hl7.fhir.r4.model.StructureDefinition) HashMap(java.util.HashMap) OutputStreamWriter(java.io.OutputStreamWriter) SearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType) BufferedWriter(java.io.BufferedWriter)

Example 5 with SearchParamType

use of org.hl7.fhir.r4b.model.Enumerations.SearchParamType in project org.hl7.fhir.core by hapifhir.

the class GraphQLSchemaGenerator method generateTypes.

public void generateTypes(Writer writer, EnumSet<FHIROperationType> operations) throws IOException {
    Map<String, StructureDefinition> pl = new HashMap<>();
    Map<String, StructureDefinition> tl = new HashMap<>();
    Map<String, String> existingTypeNames = new HashMap<>();
    for (StructureDefinition sd : context.allStructures()) {
        if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
            pl.put(sd.getName(), sd);
        }
        if (sd.getKind() == StructureDefinitionKind.COMPLEXTYPE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
            tl.put(sd.getName(), sd);
        }
    }
    writer.write("# FHIR GraphQL Schema. Version " + version + "\r\n\r\n");
    writer.write("# FHIR Defined Primitive types\r\n");
    for (String n : sorted(pl.keySet())) generatePrimitive(writer, pl.get(n));
    writer.write("\r\n");
    writer.write("# FHIR Defined Search Parameter Types\r\n");
    for (SearchParamType dir : SearchParamType.values()) {
        if (pl.containsKey(dir.toCode())) {
            // Don't double create String and URI
            continue;
        }
        if (dir != SearchParamType.NULL)
            generateSearchParamType(writer, dir.toCode());
    }
    writer.write("\r\n");
    generateElementBase(writer, operations);
    for (String n : sorted(tl.keySet())) {
        generateType(existingTypeNames, writer, tl.get(n), operations);
    }
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) HashMap(java.util.HashMap) SearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType)

Aggregations

HashMap (java.util.HashMap)3 BufferedWriter (java.io.BufferedWriter)2 OutputStreamWriter (java.io.OutputStreamWriter)2 PublicationStatusEnumFactory (org.hl7.fhir.dstu3.model.Enumerations.PublicationStatusEnumFactory)1 SearchParamTypeEnumFactory (org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory)1 SearchParamType (org.hl7.fhir.r4.model.Enumerations.SearchParamType)1 StructureDefinition (org.hl7.fhir.r4.model.StructureDefinition)1 SearchParamType (org.hl7.fhir.r4b.model.Enumerations.SearchParamType)1 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)1 CapabilityStatementRestResourceSearchParamComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent)1 SearchParamType (org.hl7.fhir.r5.model.Enumerations.SearchParamType)1 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)1