use of org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent in project kindling by HL7.
the class XmlSpecGenerator method describeSlicing.
private String describeSlicing(ElementDefinitionSlicingComponent slicing) {
CommaSeparatedStringBuilder csv = new CommaSeparatedStringBuilder();
for (ElementDefinitionSlicingDiscriminatorComponent d : slicing.getDiscriminator()) {
csv.append(d.getType().toCode() + ":" + d.getPath());
}
String s = slicing.getOrdered() ? " in any order" : " in the specified order" + (slicing.hasRules() ? slicing.getRules().getDisplay() : "");
return " sliced by " + csv.toString() + " " + s;
}
use of org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent in project kindling by HL7.
the class JsonSpecGenerator method describeSlicing.
private String describeSlicing(ElementDefinitionSlicingComponent slicing) {
CommaSeparatedStringBuilder csv = new CommaSeparatedStringBuilder();
for (ElementDefinitionSlicingDiscriminatorComponent d : slicing.getDiscriminator()) {
csv.append(d.getType().toCode() + ":" + d.getPath());
}
String s = slicing.getOrdered() ? " in any order, " : " in the specified order, " + (slicing.hasRules() ? slicing.getRules().getDisplay() : "");
return " sliced by " + csv.toString() + " " + s;
}
use of org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent in project kindling by HL7.
the class ProfileGenerator method processDiscriminator.
private void processDiscriminator(ElementDefn e, String path, ElementDefinition ce) throws Exception {
ce.setSlicing(new ElementDefinitionSlicingComponent());
ce.getSlicing().setDescription(e.getSliceDescription());
String[] d = e.getDiscriminator().get(0).split("\\|");
if (d.length >= 1)
ce.getSlicing().addDiscriminator(ProfileUtilities.interpretR2Discriminator(d[0].trim(), false));
if (d.length >= 2)
ce.getSlicing().setOrdered(Boolean.parseBoolean(d[1].trim()));
else
ce.getSlicing().setOrdered(false);
if (d.length >= 3)
ce.getSlicing().setRules(SlicingRules.fromCode(d[2].trim()));
else
ce.getSlicing().setRules(SlicingRules.OPEN);
for (int i = 1; i < e.getDiscriminator().size(); i++) {
// we've already process the first in the list
String s = e.getDiscriminator().get(i).trim();
if (s.contains("|"))
throw new Exception("illegal discriminator \"" + s + "\" at " + path);
ce.getSlicing().addDiscriminator(ProfileUtilities.interpretR2Discriminator(s, false));
}
}
use of org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent in project kindling by HL7.
the class DictHTMLGenerator method generateSlicing.
private void generateSlicing(StructureDefinition profile, ElementDefinitionSlicingComponent slicing) throws IOException {
StringBuilder b = new StringBuilder();
if (slicing.getOrdered())
b.append("<li>ordered</li>");
else
b.append("<li>unordered</li>");
if (slicing.hasRules())
b.append("<li>" + slicing.getRules().getDisplay() + "</li>");
if (!slicing.getDiscriminator().isEmpty()) {
b.append("<li>discriminators: ");
boolean first = true;
for (ElementDefinitionSlicingDiscriminatorComponent s : slicing.getDiscriminator()) {
if (first)
first = false;
else
b.append(", ");
b.append(s.getType().toCode() + ":" + s.getPath());
}
b.append("</li>");
}
tableRowNE("Slicing", "profiling.html#slicing", "This element introduces a set of slices. The slicing rules are: <ul> " + b.toString() + "</ul>");
}
use of org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method generateSlicer.
private Slicer generateSlicer(ElementDefinition child, ElementDefinitionSlicingComponent slicing, StructureDefinition structure) {
// given a child in a structure, it's sliced. figure out the slicing xpath
if (child.getPath().endsWith(".extension")) {
ElementDefinition ued = getUrlFor(structure, child);
if ((ued == null || !ued.hasFixed()) && !(child.hasType() && (child.getType().get(0).hasProfile())))
return new Slicer(false);
else {
Slicer s = new Slicer(true);
String url = (ued == null || !ued.hasFixed()) ? child.getType().get(0).getProfile() : ((UriType) ued.getFixed()).asStringValue();
s.name = " with URL = '" + url + "'";
s.criteria = "[@url = '" + url + "']";
return s;
}
} else
return new Slicer(false);
}
Aggregations