use of org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent in project kindling by HL7.
the class ResourceParser method parsePacks.
private void parsePacks(ResourceDefn r, String n, String t) throws Exception {
Set<String> codes = new HashSet<>();
ListResource list = (ListResource) parseXml("list-" + t + "-packs.xml");
for (ListResourceEntryComponent le : list.getEntry()) {
String id = le.getItem().getReference().substring(le.getItem().getReference().indexOf("/") + 1);
if (codes.contains(id)) {
throw new FHIRException("Duplicate code " + id + " for resource " + n);
}
codes.add(id);
ImplementationGuide ig = (ImplementationGuide) parseXml("implementationguide-" + id + ".xml");
if (!id.startsWith(r.getName() + "-")) {
throw new FHIRException("Illegal ig name " + id + " - should start with " + r.getName() + "-");
}
id = id.substring(t.length() + 1);
r.getConformancePackages().add(convertPack(ig, id, r.getWg()));
}
}
use of org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent in project kindling by HL7.
the class Regenerator method generatePacks.
public void generatePacks(ResourceDefn r, String root) throws IOException {
ListResource list = new ListResource();
list.setId(r.getName() + "-packs");
list.setStatus(ListStatus.CURRENT);
list.setMode(ListMode.WORKING);
// }
for (Profile p : r.getConformancePackages()) {
ListResourceEntryComponent li = list.addEntry();
li.getItem().setReference("ImplementationGuide/" + r.getName() + "-" + p.getCategory());
}
File fn = new File(Utilities.path(root, list.fhirType().toLowerCase() + "-" + list.getId() + ".gen.xml"));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), list);
fn.setLastModified(r.getTimestamp());
// }
for (Profile p : r.getConformancePackages()) {
generateCP(root, r, p);
}
}
use of org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent in project org.hl7.fhir.core by hapifhir.
the class ListRenderer method render.
public boolean render(XhtmlNode x, ListResource list) throws FHIRFormatError, DefinitionException, IOException {
if (list.hasTitle()) {
x.h2().tx(list.getTitle());
}
XhtmlNode t = x.table("clstu");
XhtmlNode tr = t.tr();
if (list.hasDate()) {
tr.td().tx("Date: " + list.getDate().toLocaleString());
}
if (list.hasMode()) {
tr.td().tx("Mode: " + list.getMode().getDisplay());
}
if (list.hasStatus()) {
tr.td().tx("Status: " + list.getStatus().getDisplay());
}
if (list.hasCode()) {
tr.td().tx("Code: " + display(list.getCode()));
}
tr = t.tr();
if (list.hasSubject()) {
shortForRef(tr.td().txN("Subject: "), list.getSubject());
}
if (list.hasEncounter()) {
shortForRef(tr.td().txN("Encounter: "), list.getEncounter());
}
if (list.hasSource()) {
shortForRef(tr.td().txN("Source: "), list.getEncounter());
}
if (list.hasOrderedBy()) {
tr.td().tx("Order: " + display(list.getOrderedBy()));
}
for (Annotation a : list.getNote()) {
renderAnnotation(x, a);
}
boolean flag = false;
boolean deleted = false;
boolean date = false;
for (ListResourceEntryComponent e : list.getEntry()) {
flag = flag || e.hasFlag();
deleted = deleted || e.hasDeleted();
date = date || e.hasDate();
}
t = x.table("grid");
tr = t.tr().style("backgound-color: #eeeeee");
tr.td().b().tx("Items");
if (date) {
tr.td().tx("Date");
}
if (flag) {
tr.td().tx("Flag");
}
if (deleted) {
tr.td().tx("Deleted");
}
for (ListResourceEntryComponent e : list.getEntry()) {
tr = t.tr();
shortForRef(tr.td(), e.getItem());
if (date) {
tr.td().tx(e.hasDate() ? e.getDate().toLocaleString() : "");
}
if (flag) {
tr.td().tx(e.hasFlag() ? display(e.getFlag()) : "");
}
if (deleted) {
tr.td().tx(e.hasDeleted() ? Boolean.toString(e.getDeleted()) : "");
}
}
return false;
}
use of org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent in project org.hl7.fhir.core by hapifhir.
the class ListRenderer method render.
public boolean render(XhtmlNode x, ListResource list) throws FHIRFormatError, DefinitionException, IOException {
if (list.hasTitle()) {
x.h2().tx(list.getTitle());
}
XhtmlNode t = x.table("clstu");
XhtmlNode tr = t.tr();
if (list.hasDate()) {
tr.td().tx("Date: " + list.getDate().toLocaleString());
}
if (list.hasMode()) {
tr.td().tx("Mode: " + list.getMode().getDisplay());
}
if (list.hasStatus()) {
tr.td().tx("Status: " + list.getStatus().getDisplay());
}
if (list.hasCode()) {
tr.td().tx("Code: " + display(list.getCode()));
}
tr = t.tr();
if (list.hasSubject()) {
shortForRef(tr.td().txN("Subject: "), list.getSubject());
}
if (list.hasEncounter()) {
shortForRef(tr.td().txN("Encounter: "), list.getEncounter());
}
if (list.hasSource()) {
shortForRef(tr.td().txN("Source: "), list.getEncounter());
}
if (list.hasOrderedBy()) {
tr.td().tx("Order: " + display(list.getOrderedBy()));
}
for (Annotation a : list.getNote()) {
renderAnnotation(x, a);
}
boolean flag = false;
boolean deleted = false;
boolean date = false;
for (ListResourceEntryComponent e : list.getEntry()) {
flag = flag || e.hasFlag();
deleted = deleted || e.hasDeleted();
date = date || e.hasDate();
}
t = x.table("grid");
tr = t.tr().style("backgound-color: #eeeeee");
tr.td().b().tx("Items");
if (date) {
tr.td().tx("Date");
}
if (flag) {
tr.td().tx("Flag");
}
if (deleted) {
tr.td().tx("Deleted");
}
for (ListResourceEntryComponent e : list.getEntry()) {
tr = t.tr();
shortForRef(tr.td(), e.getItem());
if (date) {
tr.td().tx(e.hasDate() ? e.getDate().toLocaleString() : "");
}
if (flag) {
tr.td().tx(e.hasFlag() ? display(e.getFlag()) : "");
}
if (deleted) {
tr.td().tx(e.hasDeleted() ? Boolean.toString(e.getDeleted()) : "");
}
}
return false;
}
use of org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent in project kindling by HL7.
the class SpreadSheetReloader method processOperation.
private OperationDefinition processOperation(XSSFRow row, XSSFRow cols, String name, List<ListResourceEntryComponent> entry) throws IOException {
String fn = fnOpDef(resourceName + "-" + name);
OperationDefinition opd = null;
if (new File(fn).exists()) {
opd = (OperationDefinition) parseXml(fn);
} else {
opd = new OperationDefinition();
opd.setId(name);
opd.setUrl("http://hl7.org/fhir/Operationdefinition/" + name);
opd.setName(name);
opd.setCode(name);
}
opd.setSystem(false);
opd.setType(false);
opd.setInstance(false);
for (String s : splitValue(row, cols, CN_USE, "\\|")) {
String n = s.trim();
switch(n) {
case "System":
opd.setSystem(true);
break;
case "Type":
opd.setType(true);
break;
case "Instance":
opd.setInstance(true);
break;
}
}
opd.setAffectsState(false);
opd.setKind(null);
for (String s : splitValue(row, cols, CN_TYPE, "\\|")) {
String n = s.trim();
if (n.equals("affects-state")) {
opd.setAffectsState(true);
} else {
opd.setKind(OperationKind.fromCode(n));
}
}
opd.setTitle(getValue(row, cols, CN_TITLE));
opd.setDescription(getValue(row, cols, CN_DOCUMENTATION));
opd.setComment(getValue(row, cols, CN_COMMENTS));
readExt(opd, row, cols, CN_FOOTER, BuildExtensions.EXT_FOOTER, ExtensionType.Markdown);
readExt(opd, row, cols, CN_FOOTER2, BuildExtensions.EXT_FOOTER2, ExtensionType.Markdown);
opd.getExtension().removeIf(n -> ("1".equals(n.getExtensionString(BuildExtensions.EXT_OP_EXAMPLE_LIST))));
opd.getExtension().removeIf(n -> ("2".equals(n.getExtensionString(BuildExtensions.EXT_OP_EXAMPLE_LIST))));
for (String s : splitValue(row, cols, CN_EXAMPLE1_REQUEST, "\\|")) {
Extension ext = opd.addExtension().setUrl(BuildExtensions.EXT_OP_EXAMPLE);
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_LIST, new StringType("1"));
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_RESPONSE, new BooleanType(false));
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_CONTENT, new StringType(s));
}
for (String s : splitValue(row, cols, CN_EXAMPLE1_RESPONSE, "\\|")) {
Extension ext = opd.addExtension().setUrl(BuildExtensions.EXT_OP_EXAMPLE);
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_LIST, new StringType("1"));
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_RESPONSE, new BooleanType(true));
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_CONTENT, new StringType(s));
}
for (String s : splitValue(row, cols, CN_EXAMPLE2_REQUEST, "\\|")) {
Extension ext = opd.addExtension().setUrl(BuildExtensions.EXT_OP_EXAMPLE);
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_LIST, new StringType("2"));
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_RESPONSE, new BooleanType(false));
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_CONTENT, new StringType(s));
}
for (String s : splitValue(row, cols, CN_EXAMPLE2_RESPONSE, "\\|")) {
Extension ext = opd.addExtension().setUrl(BuildExtensions.EXT_OP_EXAMPLE);
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_LIST, new StringType("2"));
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_RESPONSE, new BooleanType(true));
ext.addExtension(BuildExtensions.EXT_OP_EXAMPLE_CONTENT, new StringType(s));
}
parseStatus(opd, getValue(row, cols, CN_STATUS));
readExt(opd, row, cols, CN_COMMITTEE_NOTES, BuildExtensions.EXT_COMMITTEE_NOTES, ExtensionType.String);
return opd;
}
Aggregations