Search in sources :

Example 1 with EventUsage

use of org.hl7.fhir.definitions.model.EventUsage in project kindling by HL7.

the class PageProcessor method getEventsTable.

private String getEventsTable(String resource) throws Exception {
    List<String> codes = new ArrayList<String>();
    codes.addAll(definitions.getEvents().keySet());
    Collections.sort(codes);
    StringBuilder s = new StringBuilder();
    s.append("<table class=\"grid\">\r\n");
    s.append(" <tr><th>Code</th><th>Category</th><th>Description</th><th>Request Resources</th><th>Response Resources</th><th>Notes</th></tr>\r\n");
    for (String c : codes) {
        EventDefn e = definitions.getEvents().get(c);
        if (e.getUsages().size() == 1) {
            EventUsage u = e.getUsages().get(0);
            s.append(" <tr><td>" + e.getCode() + "<a name=\"" + e.getCode() + "\"> </a></td><td>" + (e.getCategory() == null ? "??" : e.getCategory().toString()) + "</td><td>" + e.getDefinition() + "</td>");
            s.append("<td>" + describeMsg(u.getRequestResources(), u.getRequestAggregations()) + "</td><td>" + describeMsg(u.getResponseResources(), u.getResponseAggregations()) + "</td><td>" + combineNotes(resource, e.getFollowUps(), u.getNotes(), "") + "</td></tr>\r\n");
        } else {
            boolean first = true;
            for (EventUsage u : e.getUsages()) {
                if (first)
                    s.append(" <tr><td rowspan=\"" + Integer.toString(e.getUsages().size()) + "\">" + e.getCode() + "</td><td rowspan=\"" + Integer.toString(e.getUsages().size()) + "\">" + e.getDefinition() + "</td>");
                else
                    s.append(" <tr>");
                first = false;
                s.append("<td>" + describeMsg(u.getRequestResources(), u.getRequestAggregations()) + "</td><td>" + describeMsg(u.getResponseResources(), u.getResponseAggregations()) + "</td><td>" + combineNotes(resource, e.getFollowUps(), u.getNotes(), "") + "</td></tr>\r\n");
            }
        }
    }
    s.append("</table>\r\n");
    return s.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) EventUsage(org.hl7.fhir.definitions.model.EventUsage) ArrayList(java.util.ArrayList) EventDefn(org.hl7.fhir.definitions.model.EventDefn)

Example 2 with EventUsage

use of org.hl7.fhir.definitions.model.EventUsage in project kindling by HL7.

the class OldSpreadsheetParser method readEvents.

private void readEvents(Sheet sheet, ResourceDefn root) throws Exception {
    if (sheet != null) {
        for (int row = 0; row < sheet.rows.size(); row++) {
            String code = sheet.getColumn(row, "Event Code");
            if (code != null && !code.equals("") && !code.startsWith("!")) {
                System.out.print("!!Lloyd Look at me! - event " + code + " on resource " + root.getName());
                EventDefn e = new EventDefn();
                events.add(e);
                e.setCode(code);
                e.setTitle(sheet.getColumn(row, "Title"));
                e.setDefinition(Utilities.appendPeriod(sheet.getColumn(row, "Description")));
                e.setCategory(readCategory(sheet.getColumn(row, "Category")));
                EventUsage u = new EventUsage();
                e.getUsages().add(u);
                u.setNotes(sheet.getColumn(row, "Notes"));
                for (String s : sheet.getColumn(row, "Request Resources").split(",")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        u.getRequestResources().add(s);
                }
                for (String s : sheet.getColumn(row, "Request Aggregations").split("\n")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        u.getRequestAggregations().add(s);
                }
                for (String s : sheet.getColumn(row, "Response Resources").split(",")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        u.getResponseResources().add(s);
                }
                for (String s : sheet.getColumn(row, "Response Aggregations").split("\n")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        u.getResponseAggregations().add(s);
                }
                for (String s : sheet.getColumn(row, "Follow Ups").split(",")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        e.getFollowUps().add(s);
                }
            }
        }
    }
}
Also used : EventUsage(org.hl7.fhir.definitions.model.EventUsage) EventDefn(org.hl7.fhir.definitions.model.EventDefn)

Aggregations

EventDefn (org.hl7.fhir.definitions.model.EventDefn)2 EventUsage (org.hl7.fhir.definitions.model.EventUsage)2 ArrayList (java.util.ArrayList)1 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)1