use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent in project kindling by HL7.
the class ProfileGenerator method convertElements.
public void convertElements(ElementDefn src, StructureDefinition ed, String path) throws Exception {
ElementDefinition dst = new ElementDefinition();
if (!ed.hasDifferential())
ed.setDifferential(new StructureDefinitionDifferentialComponent());
ed.getDifferential().getElement().add(dst);
String thisPath = path == null ? "Extension" : path;
dst.setId(thisPath);
dst.setPath(thisPath);
if (!Utilities.noString(src.getProfileName()))
dst.setSliceName(src.getProfileName());
dst.setShort(src.getShortDefn());
dst.setDefinition(preProcessMarkdown(src.getDefinition(), "Element Definition"));
dst.setComment(preProcessMarkdown(src.getComments(), "Element Comments"));
if (src.getMaxCardinality() != null) {
if (src.getMaxCardinality() == Integer.MAX_VALUE)
dst.setMax("*");
else
dst.setMax(src.getMaxCardinality().toString());
}
if (src.getMinCardinality() != null)
dst.setMin(src.getMinCardinality());
if (src.getFixed() != null)
dst.setFixed(src.getFixed());
if (src.hasMustSupport())
dst.setMustSupport(src.isMustSupport());
if (src.hasModifier())
dst.setIsModifier(src.isModifier());
if (dst.getIsModifier())
dst.setIsModifierReason(src.getModifierReason());
if (src.hasSummaryItem() && dst.getPath().contains("."))
dst.setIsSummaryElement(Factory.newBoolean(src.isSummary()));
for (Invariant id : src.getStatedInvariants()) dst.addCondition(id.getId());
// dDst.
for (TypeRef t : src.getTypes()) {
if (t.hasParams()) {
for (String tp : t.getParams()) {
if (definitions.hasLogicalModel(tp)) {
for (String tpn : definitions.getLogicalModel(tp).getImplementations()) {
ElementDefinition.TypeRefComponent type = dst.getType(t.getName());
String pr = "http://hl7.org/fhir/StructureDefinition/" + tpn;
type.addTargetProfile(pr);
}
} else {
ElementDefinition.TypeRefComponent type = dst.getType(t.getName());
String pr = t.hasProfile() ? t.getProfile() : // this should only happen if t.getParams().size() == 1
"http://hl7.org/fhir/StructureDefinition/" + (tp.equals("Any") ? "Resource" : tp);
if (type.getWorkingCode().equals("Reference") || type.getWorkingCode().equals("canonical") || type.getWorkingCode().equals("CodeableReference"))
type.addTargetProfile(pr);
else
type.addProfile(pr);
}
}
} else if (t.isWildcardType()) {
for (String n : TypesUtilities.wildcardTypes(version.toString())) dst.getType(n);
} else {
if (definitions != null && definitions.getConstraints().containsKey(t.getName())) {
ProfiledType ct = definitions.getConstraints().get(t.getName());
ElementDefinition.TypeRefComponent type = dst.getType(ct.getBaseType());
type.addProfile("http://hl7.org/fhir/StructureDefinition/" + ct.getName());
} else if ("Extension.url".equals(path)) {
// juat don't populate it
// ElementDefinition.TypeRefComponent tt = dst.addType();
// tt.setCodeElement(new UriType());
// tt.getFormatCommentsPre().add("Note: special primitive values do not have an assigned type. e.g. this is compiler magic. XML, JSON and RDF types provided by extension");
// ToolingExtensions.addStringExtension(tt.getCodeElement(), ToolingExtensions.EXT_JSON_TYPE, "string");
// ToolingExtensions.addStringExtension(tt.getCodeElement(), ToolingExtensions.EXT_XML_TYPE, "xs:anyURI");
// ToolingExtensions.addStringExtension(tt.getCodeElement(), ToolingExtensions.EXT_RDF_TYPE, "xs:anyURI");
} else {
ElementDefinition.TypeRefComponent type = dst.getType(t.getName());
if (t.hasProfile())
if (type.getWorkingCode().equals("Reference") || type.getWorkingCode().equals("CodeableReference"))
type.addTargetProfile(t.getProfile());
else
type.addProfile(t.getProfile());
}
}
}
if (definitions != null) {
// igtodo - catch this
for (String mu : definitions.getMapTypes().keySet()) {
if (src.hasMapping(mu)) {
addMapping(ed, dst, mu, src.getMapping(mu), null);
}
}
}
for (String in : src.getInvariants().keySet()) {
ElementDefinitionConstraintComponent con = new ElementDefinitionConstraintComponent();
Invariant inv = src.getInvariants().get(in);
con.setKey(inv.getId());
if (!con.hasKey()) {
extensionCounter++;
con.setKey("exd-" + Integer.toString(extensionCounter));
}
con.setRequirements(inv.getRequirements());
if (Utilities.noString(inv.getSeverity()))
con.setSeverity(ConstraintSeverity.ERROR);
else
con.setSeverity(ConstraintSeverity.fromCode(inv.getSeverity()));
con.setHuman(inv.getEnglish());
con.setXpath(inv.getXpath());
if (!"n/a".equals(inv.getExpression()))
con.setExpression(inv.getExpression());
dst.getConstraint().add(con);
}
if (src.hasBinding())
dst.setBinding(generateBinding(src.getBinding()));
if (src.getElements().isEmpty()) {
if (path == null)
throw new Exception("?error parsing extension");
} else {
ElementDefn url = src.getElements().get(0);
if (!url.getName().equals("url"))
throw new Exception("first child of extension should be 'url', not " + url.getName() + " for structure definition " + ed.getUrl());
convertElements(url, ed, thisPath + ".url");
// this pair might leave elements out of order, but we're going to sort them later
if (!hasValue(src)) {
ElementDefn value = new ElementDefn();
value.setName("value[x]");
value.setMinCardinality(0);
value.setMaxCardinality(0);
convertElements(value, ed, thisPath + ".value[x]");
} else {
ElementDefn ext = new ElementDefn();
// can't have an extension if you have a value
ext.setName("extension");
ext.setMaxCardinality(0);
convertElements(ext, ed, thisPath + ".extension");
}
if (src.getElements().size() == 2 && src.getElements().get(0).getName().equals("url") && src.getElements().get(1).getName().equals("value[x]")) {
ElementDefn value = src.getElements().get(1);
value.setMinCardinality(1);
convertElements(value, ed, thisPath + ".value[x]");
} else {
for (ElementDefn child : src.getElements()) {
if (child != url) {
if (child.getName().startsWith("value") && !child.getName().startsWith("valueSet"))
convertElements(child, ed, thisPath + "." + child.getName());
else {
if (child.getElements().size() == 0 || !child.getElements().get(0).getName().equals("url")) {
ElementDefn childUrl = new ElementDefn();
childUrl.setName("url");
childUrl.setXmlAttribute(true);
childUrl.getTypes().add(new TypeRef("uri"));
childUrl.setFixed(new UriType(child.getName()));
child.getElements().add(0, childUrl);
}
if (!hasValue(child)) {
ElementDefn value = new ElementDefn();
value.setName("value[x]");
value.setMinCardinality(0);
value.setMaxCardinality(0);
child.getElements().add(value);
}
convertElements(child, ed, thisPath + ".extension");
}
}
}
}
}
}
use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent in project kindling by HL7.
the class ProfileGenerator method generate.
public StructureDefinition generate(TypeDefn t) throws Exception {
genUml(t);
StructureDefinition p = new StructureDefinition();
p.setId(t.getName());
p.setUrl("http://hl7.org/fhir/StructureDefinition/" + t.getName());
p.setKind(StructureDefinitionKind.COMPLEXTYPE);
p.setAbstract(t.isAbstractType());
p.setUserData("filename", t.getName().toLowerCase());
p.setUserData("path", definitions.getSrcFile(t.getName()) + ".html#" + t.getName());
assert !Utilities.noString(t.typeCode());
String b = (t.typeCode().equals("Type") ? "Element" : t.typeCode().equals("Structure") ? "BackboneElement" : t.typeCode());
if (!Utilities.noString(b)) {
p.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/" + b);
p.setDerivation(TypeDerivationRule.SPECIALIZATION);
}
p.setType(t.getName());
p.setFhirVersion(version);
p.setVersion(version.toCode());
ToolingExtensions.setStandardsStatus(p, t.getStandardsStatus(), t.getNormativeVersion());
ToolResourceUtilities.updateUsage(p, "core");
p.setName(t.getName());
p.setPublisher("HL7 FHIR Standard");
p.addContact().getTelecom().add(Factory.newContactPoint(ContactPointSystem.URL, "http://hl7.org/fhir"));
p.setDescription("Base StructureDefinition for " + t.getName() + " Type: " + t.getDefinition());
p.setPurpose(t.getRequirements());
p.setDate(genDate.getTime());
p.setStatus(t.getStandardsStatus() == StandardsStatus.NORMATIVE ? PublicationStatus.fromCode("active") : PublicationStatus.fromCode("draft"));
Set<String> containedSlices = new HashSet<String>();
// first, the differential
p.setDifferential(new StructureDefinitionDifferentialComponent());
defineElement(null, p, p.getDifferential().getElement(), t, t.getName(), containedSlices, new ArrayList<ProfileGenerator.SliceHandle>(), SnapShotMode.None, true, "Element", b, false);
p.getDifferential().getElement().get(0).setIsSummaryElement(null);
reset();
// now. the snapshot
p.setSnapshot(new StructureDefinitionSnapshotComponent());
defineElement(null, p, p.getSnapshot().getElement(), t, t.getName(), containedSlices, new ArrayList<ProfileGenerator.SliceHandle>(), SnapShotMode.DataType, true, "Element", b, true);
for (ElementDefinition ed : p.getSnapshot().getElement()) if (ed.getBase().getPath().equals(ed.getPath()) && ed.getPath().contains("."))
generateElementDefinition(p, ed, getParent(ed, p.getSnapshot().getElement()));
containedSlices.clear();
addElementConstraintToSnapshot(p);
p.getDifferential().getElement().get(0).getType().clear();
p.getSnapshot().getElement().get(0).getType().clear();
p.getSnapshot().getElement().get(0).setIsSummaryElement(null);
XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
div.addText("to do");
p.setText(new Narrative());
p.getText().setStatus(NarrativeStatus.GENERATED);
p.getText().setDiv(div);
checkHasTypes(p);
return p;
}
use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent in project kindling by HL7.
the class ProfileGenerator method generate.
public StructureDefinition generate(DefinedStringPattern type) throws Exception {
genUml(type);
StructureDefinition p = new StructureDefinition();
p.setId(type.getCode());
p.setUrl("http://hl7.org/fhir/StructureDefinition/" + type.getCode());
p.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/" + type.getBase());
p.setType(type.getCode());
p.setDerivation(TypeDerivationRule.SPECIALIZATION);
p.setKind(StructureDefinitionKind.PRIMITIVETYPE);
p.setAbstract(false);
p.setUserData("filename", type.getCode().toLowerCase());
p.setUserData("path", "datatypes.html#" + type.getCode());
p.setFhirVersion(version);
p.setVersion(version.toCode());
ToolingExtensions.setStandardsStatus(p, StandardsStatus.NORMATIVE, "4.0.0");
ToolResourceUtilities.updateUsage(p, "core");
p.setName(type.getCode());
p.setPublisher("HL7 FHIR Standard");
p.addContact().getTelecom().add(Factory.newContactPoint(ContactPointSystem.URL, "http://hl7.org/fhir"));
p.setDescription("Base StructureDefinition for " + type.getCode() + " type: " + type.getDefinition());
p.setDate(genDate.getTime());
p.setStatus(PublicationStatus.fromCode("active"));
Set<String> containedSlices = new HashSet<String>();
// first, the differential
p.setDifferential(new StructureDefinitionDifferentialComponent());
ElementDefinition ec1 = new ElementDefinition();
p.getDifferential().getElement().add(ec1);
ec1.setId(type.getCode());
ec1.setPath(type.getCode());
ec1.setShort("Primitive Type " + type.getCode());
ec1.setDefinition(type.getDefinition());
ec1.setComment(type.getComment());
ec1.setMin(0);
ec1.setMax("*");
ElementDefinition ec2 = new ElementDefinition();
p.getDifferential().getElement().add(ec2);
ec2.setId(type.getCode() + ".value");
ec2.setPath(type.getCode() + ".value");
ec2.addRepresentation(PropertyRepresentation.XMLATTR);
ec2.setShort("Primitive value for " + type.getCode());
ec2.setDefinition("Primitive value for " + type.getCode());
ec2.setMin(0);
ec2.setMax("1");
TypeRefComponent t = ec2.addType();
t.setCodeElement(new UriType());
t.getFormatCommentsPre().add("Note: special primitive values have a FHIRPath system type. e.g. this is compiler magic (g)");
t.setCode(Constants.NS_SYSTEM_TYPE + type.getFHIRPathType());
ToolingExtensions.addUriExtension(t, ToolingExtensions.EXT_FHIR_TYPE, type.getCode());
if (!Utilities.noString(type.getRegex())) {
ToolingExtensions.addStringExtension(t, ToolingExtensions.EXT_REGEX, type.getRegex());
}
reset();
// now. the snapshot
p.setSnapshot(new StructureDefinitionSnapshotComponent());
ElementDefinition ecA = new ElementDefinition(true, ElementDefinition.NOT_MODIFIER, ElementDefinition.NOT_IN_SUMMARY);
p.getSnapshot().getElement().add(ecA);
ecA.setId(type.getCode());
ecA.setPath(type.getCode());
ecA.setShort("Primitive Type " + type.getCode());
ecA.setDefinition(type.getDefinition());
ecA.setComment(type.getComment());
ecA.setMin(0);
ecA.setMax("*");
ecA.makeBase(type.getCode(), 0, "*");
addElementConstraints("Element", ecA);
ElementDefinition ecid = new ElementDefinition(true, ElementDefinition.NOT_MODIFIER, ElementDefinition.NOT_IN_SUMMARY);
p.getSnapshot().getElement().add(ecid);
ecid.setId(type.getCode() + ".id");
ecid.setPath(type.getCode() + ".id");
ecid.addRepresentation(PropertyRepresentation.XMLATTR);
ecid.setDefinition("unique id for the element within a resource (for internal references)");
ecid.setMin(0);
ecid.setMax("1");
ecid.setShort("xml:id (or equivalent in JSON)");
TypeRefComponent tr = ecid.addType();
tr.getFormatCommentsPre().add("Note: special primitive values have a FHIRPath system type. e.g. this is compiler magic (h)");
tr.setCode(Constants.NS_SYSTEM_TYPE + "String");
ToolingExtensions.addUriExtension(tr, ToolingExtensions.EXT_FHIR_TYPE, "string");
ecid.makeBase("Element.id", 0, "1");
makeExtensionSlice("extension", p, p.getSnapshot(), null, type.getCode());
ElementDefinition ecB = new ElementDefinition(true, ElementDefinition.NOT_MODIFIER, ElementDefinition.NOT_IN_SUMMARY);
p.getSnapshot().getElement().add(ecB);
ecB.setPath(type.getCode() + ".value");
ecB.setId(type.getCode() + ".value");
ecB.addRepresentation(PropertyRepresentation.XMLATTR);
ecB.setDefinition("Primitive value for " + type.getCode());
ecB.setShort("Primitive value for " + type.getCode());
ecB.setMin(0);
ecB.setMax("1");
ecB.makeBase(type.getBase() + ".value", 0, "1");
t = ecB.addType();
t.getFormatCommentsPre().add("Note: special primitive values have a FHIRPath system type. e.g. this is compiler magic (i)");
t.setCode(Constants.NS_SYSTEM_TYPE + "String");
ToolingExtensions.addUriExtension(t, ToolingExtensions.EXT_FHIR_TYPE, "string");
if (!Utilities.noString(type.getRegex()))
ToolingExtensions.addStringExtension(t, ToolingExtensions.EXT_REGEX, type.getRegex());
// generateElementDefinition(ecB, ecA);
containedSlices.clear();
addElementConstraintToSnapshot(p);
XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
div.addText("to do");
p.setText(new Narrative());
p.getText().setStatus(NarrativeStatus.GENERATED);
p.getText().setDiv(div);
checkHasTypes(p);
return p;
}
use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent in project kindling by HL7.
the class ProfileGenerator method generate.
public StructureDefinition generate(ProfiledType pt, List<ValidationMessage> issues) throws Exception {
StructureDefinition p = new StructureDefinition();
p.setId(pt.getName());
p.setUrl("http://hl7.org/fhir/StructureDefinition/" + pt.getName());
p.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/" + pt.getBaseType());
p.setKind(StructureDefinitionKind.COMPLEXTYPE);
p.setType(pt.getBaseType());
p.setDerivation(TypeDerivationRule.CONSTRAINT);
p.setAbstract(false);
p.setUserData("filename", pt.getName().toLowerCase());
p.setUserData("path", "datatypes.html#" + pt.getName());
p.setFhirVersion(version);
p.setVersion(version.toCode());
ToolingExtensions.setStandardsStatus(p, StandardsStatus.NORMATIVE, "4.0.0");
p.setStatus(PublicationStatus.fromCode("active"));
ToolResourceUtilities.updateUsage(p, "core");
p.setName(pt.getName());
p.setPublisher("HL7 FHIR Standard");
p.addContact().getTelecom().add(Factory.newContactPoint(ContactPointSystem.URL, "http://hl7.org/fhir"));
p.setDescription("Base StructureDefinition for Type " + pt.getName() + ": " + pt.getDefinition());
p.setDescription(pt.getDefinition());
p.setDate(genDate.getTime());
// first, the differential
p.setName(pt.getName());
ElementDefinition e = new ElementDefinition();
String idroot = e.getId();
e.setPath(pt.getBaseType());
// e.setSliceName(pt.getName());
e.setShort(pt.getDefinition());
e.setDefinition(preProcessMarkdown(pt.getDescription(), "??"));
e.setMin(0);
e.setMax("*");
e.setIsModifier(false);
String s = definitions.getTLAs().get(pt.getName().toLowerCase());
if (s == null)
throw new Exception("There is no TLA for '" + pt.getName() + "' in fhir.ini");
ElementDefinitionConstraintComponent inv = new ElementDefinitionConstraintComponent();
inv.setKey(s + "-1");
inv.setRequirements(pt.getInvariant().getRequirements());
inv.setSeverity(ConstraintSeverity.ERROR);
inv.setHuman(pt.getInvariant().getEnglish());
if (!"n/a".equals(pt.getInvariant().getExpression())) {
fpUsages.add(new FHIRPathUsage(pt.getName(), pt.getName(), pt.getName(), null, pt.getInvariant().getExpression()));
inv.setExpression(pt.getInvariant().getExpression());
}
inv.setXpath(pt.getInvariant().getXpath());
e.getConstraint().add(inv);
p.setDifferential(new StructureDefinitionDifferentialComponent());
p.getDifferential().getElement().add(e);
StructureDefinition base = getTypeSnapshot(pt.getBaseType());
if (!pt.getRules().isEmpty()) {
// throw new Exception("todo");
for (String rule : pt.getRules().keySet()) {
String[] parts = rule.split("\\.");
String value = pt.getRules().get(rule);
ElementDefinition er = findElement(p.getDifferential(), pt.getBaseType() + '.' + parts[0]);
if (er == null) {
er = new ElementDefinition();
er.setId(pt.getBaseType() + ':' + p.getId() + '.' + parts[0]);
er.setPath(pt.getBaseType() + '.' + parts[0]);
p.getDifferential().getElement().add(er);
}
if (parts[1].equals("min"))
er.setMin(Integer.parseInt(value));
else if (parts[1].equals("max"))
er.setMax(value);
else if (parts[1].equals("defn"))
er.setDefinition(preProcessMarkdown(value, "er"));
}
List<String> errors = new ArrayList<String>();
new ProfileUtilities(context, null, pkp).sortDifferential(base, p, p.getName(), errors, true);
for (String se : errors) issues.add(new ValidationMessage(Source.ProfileValidator, IssueType.STRUCTURE, -1, -1, p.getUrl(), se, IssueSeverity.WARNING));
}
reset();
// now, the snapshot
new ProfileUtilities(context, issues, pkp).generateSnapshot(base, p, "http://hl7.org/fhir/StructureDefinition/" + pt.getBaseType(), "http://hl7.org/fhir", p.getName());
// for (ElementDefinition ed : p.getSnapshot().getElement())
// generateElementDefinition(ed, getParent(ed, p.getSnapshot().getElement()));
p.getDifferential().getElement().get(0).getType().clear();
p.getSnapshot().getElement().get(0).getType().clear();
XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
div.addTag("h2").addText("Data type " + pt.getName());
div.addTag("p").addText(pt.getDefinition());
div.addTag("h3").addText("Rule");
div.addTag("p").addText(pt.getInvariant().getEnglish());
div.addTag("p").addText("XPath:");
div.addTag("blockquote").addTag("pre").addText(pt.getInvariant().getXpath());
p.setText(new Narrative());
p.getText().setStatus(NarrativeStatus.GENERATED);
p.getText().setDiv(div);
addElementConstraintToSnapshot(p);
new ProfileUtilities(context, issues, pkp).setIds(p, false);
checkHasTypes(p);
return p;
}
use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent in project kindling by HL7.
the class ProfileGenerator method generateXhtml.
public StructureDefinition generateXhtml() throws Exception {
uml.getTypes().put("html:div", new UMLPrimitive("html:div"));
StructureDefinition p = new StructureDefinition();
p.setId("xhtml");
p.setUrl("http://hl7.org/fhir/StructureDefinition/xhtml");
p.setKind(StructureDefinitionKind.PRIMITIVETYPE);
p.setAbstract(false);
p.setUserData("filename", "xhtml");
p.setUserData("path", "narrative.html#xhtml");
p.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element");
p.setType("xhtml");
p.setDerivation(TypeDerivationRule.SPECIALIZATION);
p.setFhirVersion(version);
p.setVersion(version.toCode());
ToolingExtensions.setStandardsStatus(p, StandardsStatus.NORMATIVE, "4.0.0");
ToolResourceUtilities.updateUsage(p, "core");
p.setName("xhtml");
p.setPublisher("HL7 FHIR Standard");
p.addContact().getTelecom().add(Factory.newContactPoint(ContactPointSystem.URL, "http://hl7.org/fhir"));
p.setDescription("Base StructureDefinition for xhtml Type");
p.setDate(genDate.getTime());
p.setStatus(PublicationStatus.fromCode("active"));
Set<String> containedSlices = new HashSet<String>();
// first, the differential
p.setDifferential(new StructureDefinitionDifferentialComponent());
ElementDefinition ec = new ElementDefinition();
p.getDifferential().getElement().add(ec);
ec.setId("xhtml");
ec.setPath("xhtml");
ec.setShort("Primitive Type " + "xhtml");
ec.setDefinition("XHTML");
ec.setMin(0);
ec.setMax("*");
ec = new ElementDefinition();
p.getDifferential().getElement().add(ec);
ec.setId("xhtml" + ".extension");
ec.setPath("xhtml" + ".extension");
ec.setMax("0");
ec = new ElementDefinition();
p.getDifferential().getElement().add(ec);
ec.setId("xhtml" + ".value");
ec.setPath("xhtml" + ".value");
ec.addRepresentation(PropertyRepresentation.XHTML);
ec.setShort("Actual xhtml");
ec.setDefinition("Actual xhtml");
ec.setMin(1);
ec.setMax("1");
TypeRefComponent t = ec.addType();
t.setCodeElement(new UriType());
t.getFormatCommentsPre().add("Note: special primitive values have a FHIRPath system type. e.g. this is compiler magic (d)");
t.setCode(Constants.NS_SYSTEM_TYPE + "String");
ToolingExtensions.addUriExtension(t, ToolingExtensions.EXT_FHIR_TYPE, "string");
reset();
// now. the snapshot
p.setSnapshot(new StructureDefinitionSnapshotComponent());
ElementDefinition ec1 = new ElementDefinition(true, ElementDefinition.NOT_MODIFIER, ElementDefinition.NOT_IN_SUMMARY);
p.getSnapshot().getElement().add(ec1);
ec1.setId("xhtml");
ec1.setPath("xhtml");
ec1.setShort("Primitive Type " + "xhtml");
ec1.setDefinition("XHTML");
ec1.setMin(0);
ec1.setMin(0);
ec1.setMax("*");
ec1.makeBase();
generateElementDefinition(p, ec1, null);
ElementDefinition ec2 = new ElementDefinition(true, ElementDefinition.NOT_MODIFIER, ElementDefinition.NOT_IN_SUMMARY);
p.getSnapshot().getElement().add(ec2);
ec2.setId("xhtml.id");
ec2.setPath("xhtml.id");
ec2.addRepresentation(PropertyRepresentation.XMLATTR);
ec2.setDefinition("unique id for the element within a resource (for internal references)");
ec2.setMin(0);
ec2.setMax("1");
ec2.setShort("xml:id (or equivalent in JSON)");
TypeRefComponent tr = ec2.addType();
t.getFormatCommentsPre().add("Note: special primitive values have a FHIRPath system type. e.g. this is compiler magic (e)");
tr.setCode(Constants.NS_SYSTEM_TYPE + "String");
ToolingExtensions.addUriExtension(t, ToolingExtensions.EXT_FHIR_TYPE, "string");
generateElementDefinition(p, ec2, ec1);
ec2.makeBase("Element.id", 0, "1");
ElementDefinition ex = makeExtensionSlice("extension", p, p.getSnapshot(), null, "xhtml");
ex.setMax("0");
ElementDefinition ec3 = new ElementDefinition(true, ElementDefinition.NOT_MODIFIER, ElementDefinition.NOT_IN_SUMMARY);
p.getSnapshot().getElement().add(ec3);
ec3.setId("xhtml.value");
ec3.setPath("xhtml.value");
ec3.addRepresentation(PropertyRepresentation.XHTML);
ec3.setShort("Actual xhtml");
ec3.setDefinition("Actual xhtml");
ec3.setMin(1);
ec3.setMax("1");
t = ec3.addType();
t.setCodeElement(new UriType());
t.getFormatCommentsPre().add("Note: special primitive values have a FHIRPath system type. e.g. this is compiler magic (f)");
t.setCode(Constants.NS_SYSTEM_TYPE + "String");
ToolingExtensions.addUriExtension(t, ToolingExtensions.EXT_FHIR_TYPE, "string");
ec3.makeBase();
generateElementDefinition(p, ec3, ec);
containedSlices.clear();
addElementConstraintToSnapshot(p);
XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
div.addText("to do");
p.setText(new Narrative());
p.getText().setStatus(NarrativeStatus.GENERATED);
p.getText().setDiv(div);
checkHasTypes(p);
return p;
}
Aggregations