use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method listByApprovalStatus.
private void listByApprovalStatus(StringBuilder b, List<String> res, FMGApproval state, String title) throws FHIRException {
b.append("<p><b>" + title + "</b></p>\r\n");
b.append("<ul style=\"width: 90%; -moz-column-count: 4; -moz-column-gap: 10px; -webkit-column-count: 4; -webkit-column-gap: 10px; column-count: 4; column-gap: 10px\">\r\n");
for (String rn : res) {
ResourceDefn rd = definitions.getResourceByName(rn);
if (rd.getApproval() == state)
if (rd.getNormativePackage() != null || rd.getNormativeVersion() != null)
b.append(" <li><a title=\"[%resdesc " + rn + "%]\" href=\"" + rn.toLowerCase() + ".html\">" + rn + "</a> <a href=\"versions.html#std-process\" title=\"Normative Content\" class=\"normative-flag\">N</a></li>\r\n");
else
b.append(" <li><a title=\"[%resdesc " + rn + "%]\" href=\"" + rn.toLowerCase() + ".html\">" + rn + "</a></li>\r\n");
}
b.append("</ul>\r\n");
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method genImplementationList.
private String genImplementationList(ResourceDefn logical) throws FHIRException {
String url = logical.getMappingUrl();
StringBuilder b = new StringBuilder();
b.append("<table class=\"lines\">\r\n");
for (String s : sorted(definitions.getResources().keySet())) {
ResourceDefn rd = definitions.getResourceByName(s);
StructureDefinition sd = rd.getProfile();
String code = null;
for (StructureDefinitionMappingComponent m : sd.getMapping()) {
if (m.getUri().equals(url))
code = m.getIdentity();
}
if (code != null) {
if (hasLogicalMapping(sd, logical, code)) {
b.append(" <tr>\r\n");
b.append(" <td><a href=\"" + rd.getName().toLowerCase() + ".html\">" + rd.getName() + "</a> </td>\r\n");
b.append(" <td><a href=\"" + rd.getName().toLowerCase() + "-mappings.html#" + url + "\">Mappings</a> </td>\r\n");
b.append(" <td><a href=\"" + rd.getName().toLowerCase() + "-examples.html\">Examples</a></td>\r\n");
b.append(" </tr>\r\n");
}
}
}
b.append("</table>");
return b.toString();
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method buildResListByFMG.
private String buildResListByFMG() throws FHIRException {
List<String> res = new ArrayList<String>();
for (ResourceDefn rd : definitions.getBaseResources().values()) res.add(rd.getName());
for (ResourceDefn rd : definitions.getResources().values()) res.add(rd.getName());
Collections.sort(res);
StringBuilder b = new StringBuilder();
listByApprovalStatus(b, res, FMGApproval.NOPROPOSAL, "Not yet proposed");
listByApprovalStatus(b, res, FMGApproval.PENDING, "Pending");
listByApprovalStatus(b, res, FMGApproval.APPROVED, "Approved");
return b.toString();
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method buildShortParameterList.
private String buildShortParameterList(String param) throws Exception {
String[] p1 = param.split("\\:");
String[] op = p1[0].split("\\/");
String[] p = p1[1].split("\\,");
ResourceDefn rd = definitions.getResourceByName(op[0]);
Operation od = rd.getOperationByName(op[1].substring(1));
StringBuilder b = new StringBuilder();
b.append("<table class=\"grid\">\r\n");
for (OperationParameter pd : od.getParameters()) {
if (Utilities.existsInList(pd.getName(), p))
b.append("<tr><td><code>" + pd.getName() + "</code></td><td>" + processMarkdown("short param list", pd.getDoc(), "") + "</td></tr>\r\n");
}
b.append("</table>\r\n");
return b.toString();
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class ExampleInspector method fetch.
@Override
public Element fetch(IResourceValidator validator, Object appContext, String url) throws IOException, FHIRException {
String[] parts = url.split("\\/");
if (parts.length == 2 && definitions.hasResource(parts[0])) {
ResourceDefn r = definitions.getResourceByName(parts[0]);
for (Example e : r.getExamples()) {
if (e.getElement() == null && e.hasXml()) {
e.setElement(new org.hl7.fhir.r5.elementmodel.XmlParser(context).parse(e.getXml()));
if (e.getElement().getProperty().getStructure().getBaseDefinition().contains("MetadataResource")) {
String urle = e.getElement().getChildValue("url");
String v = e.getElement().getChildValue("url");
if (urle != null && urle.startsWith("http://hl7.org/fhir") && !version.toCode().equals(v)) {
e.getElement().setChildValue("version", version.toCode());
}
}
}
if (e.getElement() != null) {
if (e.getElement().fhirType().equals("Bundle")) {
for (Base b : e.getElement().listChildrenByName("entry")) {
if (b.getChildByName("resource").hasValues()) {
Element res = (Element) b.getChildByName("resource").getValues().get(0);
if (res.fhirType().equals(parts[0]) && parts[1].equals(res.getChildValue("id"))) {
return res;
}
}
}
} else if (e.getElement().fhirType().equals(parts[0]) && e.getId().equals(parts[1])) {
return e.getElement();
}
}
}
try {
if (parts[0].equals("StructureDefinition"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(StructureDefinition.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
if (parts[0].equals("OperationDefinition"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(OperationDefinition.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
if (parts[0].equals("SearchParameter"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(SearchParameter.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
if (parts[0].equals("ValueSet"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(ValueSet.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
if (parts[0].equals("CodeSystem"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(CodeSystem.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
} catch (Exception e) {
return null;
}
return null;
} else
return null;
}
Aggregations