use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project org.hl7.fhir.core by hapifhir.
the class CapabilityStatementComparer method intersectSearchParams.
private CapabilityStatementRestResourceSearchParamComponent intersectSearchParams(CapabilityStatementRestResourceSearchParamComponent l, CapabilityStatementRestResourceSearchParamComponent r) {
CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatementRestResourceSearchParamComponent();
res.setName(l.getName());
if (l.hasDocumentation() && r.hasDocumentation()) {
res.setDocumentation(l.getDocumentation());
}
return res;
}
use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project org.hl7.fhir.core by hapifhir.
the class OpenApiGenerator method generateSearchSystem.
private void generateSearchSystem(CapabilityStatementRestComponent csr) {
OperationWriter op = makePathSystem().operation("get");
op.summary("Search all resources of all types based on a set of criteria");
op.operationId("searchAll");
opOutcome(op.responses().defaultResponse());
ResponseObjectWriter resp = op.responses().httpResponse("200");
resp.description("the resource being returned");
if (isJson())
resp.content("application/fhir+json").schemaRef(specRef() + "/fhir.schema.json#/definitions/Bundle");
if (isXml())
resp.content("application/fhir+xml").schemaRef(specRef() + "/Bundle.xsd");
// todo: how do we know that these apply?
op.paramRef("#/components/parameters/format");
op.paramRef("#/components/parameters/pretty");
op.paramRef("#/components/parameters/summary");
op.paramRef("#/components/parameters/elements");
Set<String> set = new HashSet<>();
set.add("_summary");
set.add("_format");
set.add("_pretty");
set.add("_elements");
for (CapabilityStatementRestResourceSearchParamComponent spc : csr.getSearchParam()) {
if (!set.contains(spc.getName())) {
set.add(spc.getName());
ParameterWriter p = op.parameter(spc.getName());
p.in(ParameterLocation.query).description(spc.getDocumentation());
p.schema().type(getSchemaType(spc.getType()));
if (spc.hasDefinition()) {
SearchParameter sp = context.fetchResource(SearchParameter.class, spc.getDefinition());
if (sp != null) {
p.description(sp.getDescription());
}
}
}
}
}
use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project kindling by HL7.
the class Publisher method makeSearchParam.
private CapabilityStatementRestResourceSearchParamComponent makeSearchParam(String rn, SearchParameterDefn i) throws Exception {
CapabilityStatementRestResourceSearchParamComponent result = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
result.setName(i.getCode());
result.setDefinition("http://hl7.org/fhir/SearchParameter/" + i.getCommonId());
result.setType(getSearchParamType(i.getType()));
result.setDocumentation(i.getDescription());
if (Utilities.noString(i.getXPath()))
// used elsewhere later
i.setXPath(new XPathQueryGenerator(page.getDefinitions(), page, page.getQa()).generateXpath(i.getPaths(), rn));
return result;
}
use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project org.hl7.fhir.core by hapifhir.
the class CapabilityStatementComparer method compareSearchParams.
private void compareSearchParams(StructuralMatch<Element> combined, List<CapabilityStatementRestResourceSearchParamComponent> left, List<CapabilityStatementRestResourceSearchParamComponent> right, String path, CapabilityStatementComparison res, List<CapabilityStatementRestResourceSearchParamComponent> union, List<CapabilityStatementRestResourceSearchParamComponent> intersection) {
List<CapabilityStatementRestResourceSearchParamComponent> matchR = new ArrayList<>();
for (CapabilityStatementRestResourceSearchParamComponent l : left) {
CapabilityStatementRestResourceSearchParamComponent r = findInList(right, l);
if (r == null) {
union.add(l);
combined.getChildren().add(new StructuralMatch<Element>(l, vmI(IssueSeverity.INFORMATION, "Removed this Search Parameter", path)));
} else {
matchR.add(r);
CapabilityStatementRestResourceSearchParamComponent cdM = mergeSearchParams(l, r);
CapabilityStatementRestResourceSearchParamComponent cdI = intersectSearchParams(l, r);
union.add(cdM);
intersection.add(cdI);
StructuralMatch<Element> sm = new StructuralMatch<Element>(l, r);
compareStrings(path, sm.getMessages(), l.getDocumentation(), r.getDocumentation(), "documentation", IssueSeverity.INFORMATION, res);
compareItemProperty(sm, "type", l.getTypeElement(), r.getTypeElement(), path, res, cdM.getTypeElement(), cdI.getTypeElement(), IssueSeverity.ERROR);
compareItemProperty(sm, "definition", l.getDefinitionElement(), r.getDefinitionElement(), path, res, cdM.getDefinitionElement(), cdI.getDefinitionElement(), IssueSeverity.ERROR);
compareExpectations(sm, l, r, path, res, cdM, cdI);
combined.getChildren().add(sm);
}
}
for (CapabilityStatementRestResourceSearchParamComponent r : right) {
if (!matchR.contains(r)) {
union.add(r);
combined.getChildren().add(new StructuralMatch<Element>(vmI(IssueSeverity.INFORMATION, "Added this Search Parameter", path), r));
}
}
}
use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project org.hl7.fhir.core by hapifhir.
the class CapabilityStatementComparer method intersectSearchParams.
private CapabilityStatementRestResourceSearchParamComponent intersectSearchParams(CapabilityStatementRestResourceSearchParamComponent l, CapabilityStatementRestResourceSearchParamComponent r) {
CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatementRestResourceSearchParamComponent();
res.setName(l.getName());
if (l.hasDocumentation() && r.hasDocumentation()) {
res.setDocumentation(l.getDocumentation());
}
return res;
}
Aggregations