use of org.hl7.fhir.r5.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;
}
use of org.hl7.fhir.r5.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;
}
use of org.hl7.fhir.r5.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();
}
use of org.hl7.fhir.r5.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();
}
use of org.hl7.fhir.r5.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);
}
}
Aggregations