use of org.hl7.fhir.dstu3.model.RelatedArtifact in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeEvidence.
protected void composeEvidence(Complex parent, String parentType, String name, Evidence element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Evidence", name, element, index);
if (element.hasUrlElement())
composeUri(t, "Evidence", "url", element.getUrlElement(), -1);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Evidence", "identifier", element.getIdentifier().get(i), i);
if (element.hasVersionElement())
composeString(t, "Evidence", "version", element.getVersionElement(), -1);
if (element.hasNameElement())
composeString(t, "Evidence", "name", element.getNameElement(), -1);
if (element.hasTitleElement())
composeString(t, "Evidence", "title", element.getTitleElement(), -1);
if (element.hasShortTitleElement())
composeString(t, "Evidence", "shortTitle", element.getShortTitleElement(), -1);
if (element.hasSubtitleElement())
composeString(t, "Evidence", "subtitle", element.getSubtitleElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "Evidence", "status", element.getStatusElement(), -1);
if (element.hasDateElement())
composeDateTime(t, "Evidence", "date", element.getDateElement(), -1);
if (element.hasPublisherElement())
composeString(t, "Evidence", "publisher", element.getPublisherElement(), -1);
for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "Evidence", "contact", element.getContact().get(i), i);
if (element.hasDescriptionElement())
composeMarkdown(t, "Evidence", "description", element.getDescriptionElement(), -1);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "Evidence", "note", element.getNote().get(i), i);
for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "Evidence", "useContext", element.getUseContext().get(i), i);
for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "Evidence", "jurisdiction", element.getJurisdiction().get(i), i);
if (element.hasCopyrightElement())
composeMarkdown(t, "Evidence", "copyright", element.getCopyrightElement(), -1);
if (element.hasApprovalDateElement())
composeDate(t, "Evidence", "approvalDate", element.getApprovalDateElement(), -1);
if (element.hasLastReviewDateElement())
composeDate(t, "Evidence", "lastReviewDate", element.getLastReviewDateElement(), -1);
if (element.hasEffectivePeriod())
composePeriod(t, "Evidence", "effectivePeriod", element.getEffectivePeriod(), -1);
for (int i = 0; i < element.getTopic().size(); i++) composeCodeableConcept(t, "Evidence", "topic", element.getTopic().get(i), i);
for (int i = 0; i < element.getAuthor().size(); i++) composeContactDetail(t, "Evidence", "author", element.getAuthor().get(i), i);
for (int i = 0; i < element.getEditor().size(); i++) composeContactDetail(t, "Evidence", "editor", element.getEditor().get(i), i);
for (int i = 0; i < element.getReviewer().size(); i++) composeContactDetail(t, "Evidence", "reviewer", element.getReviewer().get(i), i);
for (int i = 0; i < element.getEndorser().size(); i++) composeContactDetail(t, "Evidence", "endorser", element.getEndorser().get(i), i);
for (int i = 0; i < element.getRelatedArtifact().size(); i++) composeRelatedArtifact(t, "Evidence", "relatedArtifact", element.getRelatedArtifact().get(i), i);
if (element.hasExposureBackground())
composeReference(t, "Evidence", "exposureBackground", element.getExposureBackground(), -1);
for (int i = 0; i < element.getExposureVariant().size(); i++) composeReference(t, "Evidence", "exposureVariant", element.getExposureVariant().get(i), i);
for (int i = 0; i < element.getOutcome().size(); i++) composeReference(t, "Evidence", "outcome", element.getOutcome().get(i), i);
}
use of org.hl7.fhir.dstu3.model.RelatedArtifact in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeRelatedArtifact.
protected void composeRelatedArtifact(Complex parent, String parentType, String name, RelatedArtifact element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeElement(t, "RelatedArtifact", name, element, index);
if (element.hasTypeElement())
composeEnum(t, "RelatedArtifact", "type", element.getTypeElement(), -1);
if (element.hasLabelElement())
composeString(t, "RelatedArtifact", "label", element.getLabelElement(), -1);
if (element.hasDisplayElement())
composeString(t, "RelatedArtifact", "display", element.getDisplayElement(), -1);
if (element.hasCitationElement())
composeMarkdown(t, "RelatedArtifact", "citation", element.getCitationElement(), -1);
if (element.hasUrlElement())
composeUrl(t, "RelatedArtifact", "url", element.getUrlElement(), -1);
if (element.hasDocument())
composeAttachment(t, "RelatedArtifact", "document", element.getDocument(), -1);
if (element.hasResourceElement())
composeCanonical(t, "RelatedArtifact", "resource", element.getResourceElement(), -1);
}
use of org.hl7.fhir.dstu3.model.RelatedArtifact in project org.hl7.fhir.core by hapifhir.
the class ProfileDrivenRenderer method displayLeaf.
private boolean displayLeaf(ResourceWrapper res, BaseWrapper ew, ElementDefinition defn, XhtmlNode x, String name, boolean showCodeDetails, boolean allowLinks) throws FHIRException, UnsupportedEncodingException, IOException {
if (ew == null)
return false;
Base e = ew.getBase();
if (e == null)
return false;
Map<String, String> displayHints = readDisplayHints(defn);
if (name.endsWith("[x]"))
name = name.substring(0, name.length() - 3);
if (!showCodeDetails && e instanceof PrimitiveType && isDefault(displayHints, ((PrimitiveType) e)))
return false;
if (e instanceof StringType) {
x.addText(name + ": " + ((StringType) e).getValue());
return true;
} else if (e instanceof CodeType) {
x.addText(name + ": " + ((CodeType) e).getValue());
return true;
} else if (e instanceof IdType) {
x.addText(name + ": " + ((IdType) e).getValue());
return true;
} else if (e instanceof UriType) {
if (Utilities.isAbsoluteUrlLinkable(((UriType) e).getValue()) && allowLinks) {
x.tx(name + ": ");
x.ah(((UriType) e).getValue()).addText(((UriType) e).getValue());
} else {
x.addText(name + ": " + ((UriType) e).getValue());
}
return true;
} else if (e instanceof DateTimeType) {
x.addText(name + ": " + ((DateTimeType) e).toHumanDisplay());
return true;
} else if (e instanceof InstantType) {
x.addText(name + ": " + ((InstantType) e).toHumanDisplay());
return true;
} else if (e instanceof Extension) {
// x.tx("Extensions: todo");
return false;
} else if (e instanceof org.hl7.fhir.r5.model.DateType) {
x.addText(name + ": " + ((org.hl7.fhir.r5.model.DateType) e).toHumanDisplay());
return true;
} else if (e instanceof Enumeration) {
// todo: look up a display name if there is one
x.addText(((Enumeration<?>) e).getValue().toString());
return true;
} else if (e instanceof BooleanType) {
if (((BooleanType) e).hasValue()) {
x.addText(name);
x.addText(": ");
x.addText(((BooleanType) e).getValueAsString());
return true;
}
} else if (e instanceof CodeableReference) {
if (((CodeableReference) e).hasReference()) {
Reference r = ((CodeableReference) e).getReference();
renderReference(res, x, r, allowLinks);
} else {
renderCodeableConcept(x, ((CodeableReference) e).getConcept(), showCodeDetails);
}
return true;
} else if (e instanceof CodeableConcept) {
renderCodeableConcept(x, (CodeableConcept) e, showCodeDetails);
return true;
} else if (e instanceof Coding) {
renderCoding(x, (Coding) e, showCodeDetails);
return true;
} else if (e instanceof Annotation) {
renderAnnotation(x, (Annotation) e, showCodeDetails);
return true;
} else if (e instanceof org.hl7.fhir.r5.model.IntegerType) {
x.addText(Integer.toString(((org.hl7.fhir.r5.model.IntegerType) e).getValue()));
return true;
} else if (e instanceof org.hl7.fhir.r5.model.DecimalType) {
x.addText(((org.hl7.fhir.r5.model.DecimalType) e).getValue().toString());
return true;
} else if (e instanceof Identifier) {
renderIdentifier(x, (Identifier) e);
return true;
} else if (e instanceof HumanName) {
renderHumanName(x, (HumanName) e);
return true;
} else if (e instanceof SampledData) {
renderSampledData(x, (SampledData) e);
return true;
} else if (e instanceof Address) {
renderAddress(x, (Address) e);
return true;
} else if (e instanceof ContactPoint) {
if (allowLinks) {
renderContactPoint(x, (ContactPoint) e);
} else {
displayContactPoint(x, (ContactPoint) e);
}
return true;
} else if (e instanceof Timing) {
renderTiming(x, (Timing) e);
return true;
} else if (e instanceof Quantity) {
renderQuantity(x, (Quantity) e, showCodeDetails);
return true;
} else if (e instanceof Ratio) {
renderQuantity(x, ((Ratio) e).getNumerator(), showCodeDetails);
x.tx("/");
renderQuantity(x, ((Ratio) e).getDenominator(), showCodeDetails);
return true;
} else if (e instanceof Period) {
Period p = (Period) e;
x.addText(name + ": ");
x.addText(!p.hasStart() ? "?ngen-2?" : p.getStartElement().toHumanDisplay());
x.tx(" --> ");
x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
return true;
} else if (e instanceof Reference) {
Reference r = (Reference) e;
if (r.hasDisplayElement())
x.addText(r.getDisplay());
else if (r.hasReferenceElement()) {
ResourceWithReference tr = resolveReference(res, r.getReference());
// getDisplayForReference(tr.getReference()));
x.addText(tr == null ? r.getReference() : "?ngen-3");
} else
x.tx("?ngen-4?");
return true;
} else if (e instanceof Narrative) {
return false;
} else if (e instanceof Resource) {
return false;
} else if (e instanceof ContactDetail) {
ContactDetail cd = (ContactDetail) e;
if (cd.hasName()) {
x.tx(cd.getName() + ": ");
}
boolean first = true;
for (ContactPoint c : cd.getTelecom()) {
if (first)
first = false;
else
x.tx(",");
if (allowLinks) {
renderContactPoint(x, c);
} else {
displayContactPoint(x, c);
}
}
return true;
} else if (e instanceof Range) {
return false;
} else if (e instanceof Meta) {
return false;
} else if (e instanceof Dosage) {
return false;
} else if (e instanceof Signature) {
return false;
} else if (e instanceof UsageContext) {
return false;
} else if (e instanceof RelatedArtifact) {
return false;
} else if (e instanceof ElementDefinition) {
return false;
} else if (e instanceof Base64BinaryType) {
return false;
} else if (!(e instanceof Attachment))
throw new NotImplementedException("type " + e.getClass().getName() + " not handled yet");
return false;
}
use of org.hl7.fhir.dstu3.model.RelatedArtifact in project org.hl7.fhir.core by hapifhir.
the class LibraryRenderer method renderArtifact.
private void renderArtifact(XhtmlNode t, RelatedArtifact ra, Resource lib, boolean label, boolean display, boolean citation) throws IOException {
XhtmlNode tr = t.tr();
tr.td().tx(ra.getType().getDisplay());
if (label) {
tr.td().tx(ra.getLabel());
}
if (display) {
tr.td().tx(ra.getDisplay());
}
if (citation) {
tr.td().markdown(ra.getCitation(), "Citation");
}
if (ra.hasResource()) {
renderCanonical(lib, tr.td(), ra.getResource());
} else {
renderAttachment(tr.td(), ra.getDocument(), false, 0, lib.getId());
}
}
use of org.hl7.fhir.dstu3.model.RelatedArtifact in project org.hl7.fhir.core by hapifhir.
the class JsonParser method composeType.
protected void composeType(String prefix, DataType type) throws IOException {
if (type == null) {
;
} else if (type instanceof Address) {
composeAddress(prefix + "Address", (Address) type);
} else if (type instanceof Age) {
composeAge(prefix + "Age", (Age) type);
} else if (type instanceof Annotation) {
composeAnnotation(prefix + "Annotation", (Annotation) type);
} else if (type instanceof Attachment) {
composeAttachment(prefix + "Attachment", (Attachment) type);
} else if (type instanceof CodeableConcept) {
composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) type);
} else if (type instanceof CodeableReference) {
composeCodeableReference(prefix + "CodeableReference", (CodeableReference) type);
} else if (type instanceof Coding) {
composeCoding(prefix + "Coding", (Coding) type);
} else if (type instanceof ContactDetail) {
composeContactDetail(prefix + "ContactDetail", (ContactDetail) type);
} else if (type instanceof ContactPoint) {
composeContactPoint(prefix + "ContactPoint", (ContactPoint) type);
} else if (type instanceof Contributor) {
composeContributor(prefix + "Contributor", (Contributor) type);
} else if (type instanceof Count) {
composeCount(prefix + "Count", (Count) type);
} else if (type instanceof DataRequirement) {
composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
} else if (type instanceof Distance) {
composeDistance(prefix + "Distance", (Distance) type);
} else if (type instanceof Dosage) {
composeDosage(prefix + "Dosage", (Dosage) type);
} else if (type instanceof Duration) {
composeDuration(prefix + "Duration", (Duration) type);
} else if (type instanceof ElementDefinition) {
composeElementDefinition(prefix + "ElementDefinition", (ElementDefinition) type);
} else if (type instanceof Expression) {
composeExpression(prefix + "Expression", (Expression) type);
} else if (type instanceof Extension) {
composeExtension(prefix + "Extension", (Extension) type);
} else if (type instanceof HumanName) {
composeHumanName(prefix + "HumanName", (HumanName) type);
} else if (type instanceof Identifier) {
composeIdentifier(prefix + "Identifier", (Identifier) type);
} else if (type instanceof MarketingStatus) {
composeMarketingStatus(prefix + "MarketingStatus", (MarketingStatus) type);
} else if (type instanceof Meta) {
composeMeta(prefix + "Meta", (Meta) type);
} else if (type instanceof Money) {
composeMoney(prefix + "Money", (Money) type);
} else if (type instanceof Narrative) {
composeNarrative(prefix + "Narrative", (Narrative) type);
} else if (type instanceof ParameterDefinition) {
composeParameterDefinition(prefix + "ParameterDefinition", (ParameterDefinition) type);
} else if (type instanceof Period) {
composePeriod(prefix + "Period", (Period) type);
} else if (type instanceof Population) {
composePopulation(prefix + "Population", (Population) type);
} else if (type instanceof ProdCharacteristic) {
composeProdCharacteristic(prefix + "ProdCharacteristic", (ProdCharacteristic) type);
} else if (type instanceof ProductShelfLife) {
composeProductShelfLife(prefix + "ProductShelfLife", (ProductShelfLife) type);
} else if (type instanceof Quantity) {
composeQuantity(prefix + "Quantity", (Quantity) type);
} else if (type instanceof Range) {
composeRange(prefix + "Range", (Range) type);
} else if (type instanceof Ratio) {
composeRatio(prefix + "Ratio", (Ratio) type);
} else if (type instanceof RatioRange) {
composeRatioRange(prefix + "RatioRange", (RatioRange) type);
} else if (type instanceof Reference) {
composeReference(prefix + "Reference", (Reference) type);
} else if (type instanceof RelatedArtifact) {
composeRelatedArtifact(prefix + "RelatedArtifact", (RelatedArtifact) type);
} else if (type instanceof SampledData) {
composeSampledData(prefix + "SampledData", (SampledData) type);
} else if (type instanceof Signature) {
composeSignature(prefix + "Signature", (Signature) type);
} else if (type instanceof Timing) {
composeTiming(prefix + "Timing", (Timing) type);
} else if (type instanceof TriggerDefinition) {
composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) type);
} else if (type instanceof UsageContext) {
composeUsageContext(prefix + "UsageContext", (UsageContext) type);
} else if (type instanceof CodeType) {
composeCodeCore(prefix + "Code", (CodeType) type, false);
composeCodeExtras(prefix + "Code", (CodeType) type, false);
} else if (type instanceof OidType) {
composeOidCore(prefix + "Oid", (OidType) type, false);
composeOidExtras(prefix + "Oid", (OidType) type, false);
} else if (type instanceof CanonicalType) {
composeCanonicalCore(prefix + "Canonical", (CanonicalType) type, false);
composeCanonicalExtras(prefix + "Canonical", (CanonicalType) type, false);
} else if (type instanceof UuidType) {
composeUuidCore(prefix + "Uuid", (UuidType) type, false);
composeUuidExtras(prefix + "Uuid", (UuidType) type, false);
} else if (type instanceof UrlType) {
composeUrlCore(prefix + "Url", (UrlType) type, false);
composeUrlExtras(prefix + "Url", (UrlType) type, false);
} else if (type instanceof UnsignedIntType) {
composeUnsignedIntCore(prefix + "UnsignedInt", (UnsignedIntType) type, false);
composeUnsignedIntExtras(prefix + "UnsignedInt", (UnsignedIntType) type, false);
} else if (type instanceof MarkdownType) {
composeMarkdownCore(prefix + "Markdown", (MarkdownType) type, false);
composeMarkdownExtras(prefix + "Markdown", (MarkdownType) type, false);
} else if (type instanceof IdType) {
composeIdCore(prefix + "Id", (IdType) type, false);
composeIdExtras(prefix + "Id", (IdType) type, false);
} else if (type instanceof PositiveIntType) {
composePositiveIntCore(prefix + "PositiveInt", (PositiveIntType) type, false);
composePositiveIntExtras(prefix + "PositiveInt", (PositiveIntType) type, false);
} else if (type instanceof DateType) {
composeDateCore(prefix + "Date", (DateType) type, false);
composeDateExtras(prefix + "Date", (DateType) type, false);
} else if (type instanceof DateTimeType) {
composeDateTimeCore(prefix + "DateTime", (DateTimeType) type, false);
composeDateTimeExtras(prefix + "DateTime", (DateTimeType) type, false);
} else if (type instanceof StringType) {
composeStringCore(prefix + "String", (StringType) type, false);
composeStringExtras(prefix + "String", (StringType) type, false);
} else if (type instanceof IntegerType) {
composeIntegerCore(prefix + "Integer", (IntegerType) type, false);
composeIntegerExtras(prefix + "Integer", (IntegerType) type, false);
} else if (type instanceof Integer64Type) {
composeInteger64Core(prefix + "Integer64", (Integer64Type) type, false);
composeInteger64Extras(prefix + "Integer64", (Integer64Type) type, false);
} else if (type instanceof UriType) {
composeUriCore(prefix + "Uri", (UriType) type, false);
composeUriExtras(prefix + "Uri", (UriType) type, false);
} else if (type instanceof InstantType) {
composeInstantCore(prefix + "Instant", (InstantType) type, false);
composeInstantExtras(prefix + "Instant", (InstantType) type, false);
} else if (type instanceof BooleanType) {
composeBooleanCore(prefix + "Boolean", (BooleanType) type, false);
composeBooleanExtras(prefix + "Boolean", (BooleanType) type, false);
} else if (type instanceof Base64BinaryType) {
composeBase64BinaryCore(prefix + "Base64Binary", (Base64BinaryType) type, false);
composeBase64BinaryExtras(prefix + "Base64Binary", (Base64BinaryType) type, false);
} else if (type instanceof TimeType) {
composeTimeCore(prefix + "Time", (TimeType) type, false);
composeTimeExtras(prefix + "Time", (TimeType) type, false);
} else if (type instanceof DecimalType) {
composeDecimalCore(prefix + "Decimal", (DecimalType) type, false);
composeDecimalExtras(prefix + "Decimal", (DecimalType) type, false);
} else
throw new Error("Unhandled type");
}
Aggregations