Java Code Examples for org.hl7.fhir.utilities.xhtml.XhtmlNode#h2()

The following examples show how to use org.hl7.fhir.utilities.xhtml.XhtmlNode#h2() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeSystemRenderer.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public boolean render(XhtmlNode x, CodeSystem cs) throws FHIRFormatError, DefinitionException, IOException {
  boolean hasExtensions = false;

  if (context.isHeader()) {
    XhtmlNode h = x.h2();
    h.addText(cs.hasTitle() ? cs.getTitle() : cs.getName());
    addMarkdown(x, cs.getDescription());
    if (cs.hasCopyright())
      generateCopyright(x, cs);
  }

  generateProperties(x, cs);
  generateFilters(x, cs);
  List<UsedConceptMap> maps = new ArrayList<UsedConceptMap>();
  hasExtensions = generateCodeSystemContent(x, cs, hasExtensions, maps);

  return hasExtensions;
}
 
Example 2
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
private boolean generateDefinition(XhtmlNode x, CodeSystem cs, boolean header, String lang) throws FHIRFormatError, DefinitionException, IOException {
  boolean hasExtensions = false;

  if (header) {
    XhtmlNode h = x.h2();
    h.addText(cs.hasTitle() ? cs.getTitle() : cs.getName());
    addMarkdown(x, cs.getDescription());
    if (cs.hasCopyright())
      generateCopyright(x, cs, lang);
  }

  generateProperties(x, cs, lang);
  generateFilters(x, cs, lang);
  List<UsedConceptMap> maps = new ArrayList<UsedConceptMap>();
  hasExtensions = generateCodeSystemContent(x, cs, hasExtensions, maps, lang);

  return hasExtensions;
}
 
Example 3
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private boolean generateDefinition(XhtmlNode x, CodeSystem cs, boolean header) throws FHIRFormatError, DefinitionException, IOException {
    boolean hasExtensions = false;
    Map<ConceptMap, String> mymaps = new HashMap<ConceptMap, String>();
//    for (ConceptMap a : context.findMapsForSource(cs.getValueSet())) {
//      String url = "";
//      ValueSet vsr = context.fetchResource(ValueSet.class, ((Reference) a.getTarget()).getReference());
//      if (vsr != null)
//        url = (String) vsr.getUserData("filename");
//      mymaps.put(a, url);
//    }
    // also, look in the contained resources for a concept map
    for (Resource r : cs.getContained()) {
      if (r instanceof ConceptMap) {
        ConceptMap cm = (ConceptMap) r;
        if (((Reference) cm.getSource()).getReference().equals(cs.getValueSet())) {
          String url = "";
          ValueSet vsr = context.fetchResource(ValueSet.class, ((Reference) cm.getTarget()).getReference());
          if (vsr != null)
              url = (String) vsr.getUserData("filename");
        mymaps.put(cm, url);
        }
      }
    }
    List<String> langs = new ArrayList<String>();

    if (header) {
      XhtmlNode h = x.h2();
      h.addText(cs.hasTitle() ? cs.getTitle() : cs.getName());
      addMarkdown(x, cs.getDescription());
      if (cs.hasCopyright())
        generateCopyright(x, cs);
    }

    generateProperties(x, cs);
    generateFilters(x, cs);
    hasExtensions = generateCodeSystemContent(x, cs, hasExtensions, mymaps, langs);

    return hasExtensions;
  }
 
Example 4
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private boolean generateComposition(ResourceContext rcontext, XhtmlNode x, ValueSet vs, boolean header, List<UsedConceptMap> maps) throws FHIRException, IOException {
 boolean hasExtensions = false;
  List<String> langs = new ArrayList<String>();

  if (header) {
    XhtmlNode h = x.h2();
    h.addText(vs.present());
    addMarkdown(x, vs.getDescription());
    if (vs.hasCopyrightElement())
      generateCopyright(x, vs);
  }
  XhtmlNode p = x.para();
  p.tx("This value set includes codes from the following code systems:");

  XhtmlNode ul = x.ul();
  XhtmlNode li;
  for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
    hasExtensions = genInclude(rcontext, ul, inc, "Include", langs, maps) || hasExtensions;
  }
  for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
    hasExtensions = genInclude(rcontext, ul, exc, "Exclude", langs, maps) || hasExtensions;
  }

  // now, build observed languages

  if (langs.size() > 0) {
    Collections.sort(langs);
    x.para().b().tx("Additional Language Displays");
    XhtmlNode t = x.table( "codes");
    XhtmlNode tr = t.tr();
    tr.td().b().tx("Code");
    for (String lang : langs)
      tr.td().b().addText(describeLang(lang));
    for (ConceptSetComponent c : vs.getCompose().getInclude()) {
      for (ConceptReferenceComponent cc : c.getConcept()) {
        addLanguageRow(cc, t, langs);
      }
    }
  }

  return hasExtensions;
}
 
Example 5
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private boolean generateComposition(ResourceContext rcontext, XhtmlNode x, ValueSet vs, boolean header) throws FHIRException, IOException {
 boolean hasExtensions = false;
  List<String> langs = new ArrayList<String>();

  if (header) {
    XhtmlNode h = x.h2();
    h.addText(vs.getName());
    addMarkdown(x, vs.getDescription());
    if (vs.hasCopyrightElement())
      generateCopyright(x, vs);
  }
  XhtmlNode p = x.para();
  p.tx("This value set includes codes from the following code systems:");

  XhtmlNode ul = x.ul();
  XhtmlNode li;
  for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
    hasExtensions = genInclude(rcontext, ul, inc, "Include", langs) || hasExtensions;
  }
  for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
    hasExtensions = genInclude(rcontext, ul, exc, "Exclude", langs) || hasExtensions;
  }

  // now, build observed languages

  if (langs.size() > 0) {
    Collections.sort(langs);
    x.para().b().tx("Additional Language Displays");
    XhtmlNode t = x.table( "codes");
    XhtmlNode tr = t.tr();
    tr.td().b().tx("Code");
    for (String lang : langs)
      tr.td().b().addText(describeLang(lang));
    for (ConceptSetComponent c : vs.getCompose().getInclude()) {
      for (ConceptReferenceComponent cc : c.getConcept()) {
        addLanguageRow(cc, t, langs);
      }
    }
  }

  return hasExtensions;
}