use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method genTypes.
private Cell genTypes(HierarchicalTableGenerator gen, Row r, ElementDefinition e, String profileBaseFileName, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean mustSupportMode) {
Cell c = gen.new Cell();
r.getCells().add(c);
if (e.hasContentReference()) {
ElementInStructure ed = getElementByName(profile.getSnapshot().getElement(), e.getContentReference(), profile);
if (ed == null)
c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", e.getContentReference()), null));
else {
if (ed.getSource() == profile) {
c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getElement().getPath()), null));
c.getPieces().add(gen.new Piece("#" + ed.getElement().getPath(), tail(ed.getElement().getPath()), ed.getElement().getPath()));
} else {
c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getElement().getPath()), null));
c.getPieces().add(gen.new Piece(pfx(corePath, ed.getSource().getUserString("path")) + "#" + ed.getElement().getPath(), tail(ed.getElement().getPath()) + " (" + ed.getSource().getType() + ")", ed.getElement().getPath()));
}
}
return c;
}
List<TypeRefComponent> types = e.getType();
if (!e.hasType()) {
if (root) {
// we'll use base instead of types then
StructureDefinition bsd = profile == null ? null : context.fetchResource(StructureDefinition.class, profile.getBaseDefinition());
if (bsd != null) {
if (bsd.hasUserData("path")) {
c.getPieces().add(gen.new Piece(Utilities.isAbsoluteUrl(bsd.getUserString("path")) ? bsd.getUserString("path") : imagePath + bsd.getUserString("path"), bsd.getName(), null));
} else {
c.getPieces().add(gen.new Piece(null, bsd.getName(), null));
}
}
return c;
} else if (e.hasContentReference()) {
return c;
} else {
ElementDefinition d = (ElementDefinition) e.getUserData(DERIVATION_POINTER);
if (d != null && d.hasType()) {
types = new ArrayList<ElementDefinition.TypeRefComponent>();
for (TypeRefComponent tr : d.getType()) {
TypeRefComponent tt = tr.copy();
tt.setUserData(DERIVATION_EQUALS, true);
types.add(tt);
}
} else {
return c;
}
}
}
boolean first = true;
TypeRefComponent tl = null;
for (TypeRefComponent t : types) {
if (!mustSupportMode || allTypesMustSupport(e) || isMustSupport(t)) {
if (first) {
first = false;
} else {
c.addPiece(checkForNoChange(tl, gen.new Piece(null, ", ", null)));
}
tl = t;
if (t.hasTarget()) {
c.getPieces().add(gen.new Piece(corePath + "references.html", t.getWorkingCode(), null));
if (!mustSupportMode && isMustSupportDirect(t) && e.getMustSupport()) {
c.addPiece(gen.new Piece(null, " ", null));
c.addStyledText(translate("sd.table", "This type must be supported"), "S", "white", "red", null, false);
}
c.getPieces().add(gen.new Piece(null, "(", null));
boolean tfirst = true;
for (CanonicalType u : t.getTargetProfile()) {
if (!mustSupportMode || allProfilesMustSupport(t.getTargetProfile()) || isMustSupport(u)) {
if (tfirst)
tfirst = false;
else
c.addPiece(gen.new Piece(null, " | ", null));
genTargetLink(gen, profileBaseFileName, corePath, c, t, u.getValue());
if (!mustSupportMode && isMustSupport(u) && e.getMustSupport()) {
c.addPiece(gen.new Piece(null, " ", null));
c.addStyledText(translate("sd.table", "This target must be supported"), "S", "white", "red", null, false);
}
}
}
c.getPieces().add(gen.new Piece(null, ")", null));
if (t.getAggregation().size() > 0) {
c.getPieces().add(gen.new Piece(corePath + "valueset-resource-aggregation-mode.html", " {", null));
boolean firstA = true;
for (Enumeration<AggregationMode> a : t.getAggregation()) {
if (firstA = true)
firstA = false;
else
c.getPieces().add(gen.new Piece(corePath + "valueset-resource-aggregation-mode.html", ", ", null));
c.getPieces().add(gen.new Piece(corePath + "valueset-resource-aggregation-mode.html", codeForAggregation(a.getValue()), hintForAggregation(a.getValue())));
}
c.getPieces().add(gen.new Piece(corePath + "valueset-resource-aggregation-mode.html", "}", null));
}
} else if (t.hasProfile() && (!t.getWorkingCode().equals("Extension") || isProfiledType(t.getProfile()))) {
// a profiled type
String ref;
boolean pfirst = true;
for (CanonicalType p : t.getProfile()) {
if (!mustSupportMode || allProfilesMustSupport(t.getProfile()) || isMustSupport(p)) {
if (pfirst) {
pfirst = false;
} else {
c.addPiece(checkForNoChange(tl, gen.new Piece(null, ", ", null)));
}
ref = pkp == null ? null : pkp.getLinkForProfile(profile, p.getValue());
if (ref != null) {
String[] parts = ref.split("\\|");
if (parts[0].startsWith("http:") || parts[0].startsWith("https:")) {
// c.addPiece(checkForNoChange(t, gen.new Piece(parts[0], "<" + parts[1] + ">", t.getCode()))); Lloyd
c.addPiece(checkForNoChange(t, gen.new Piece(parts[0], parts[1], t.getWorkingCode())));
} else {
// c.addPiece(checkForNoChange(t, gen.new Piece((t.getProfile().startsWith(corePath)? corePath: "")+parts[0], "<" + parts[1] + ">", t.getCode())));
c.addPiece(checkForNoChange(t, gen.new Piece((p.getValue().startsWith(corePath + "StructureDefinition") ? corePath : "") + parts[0], parts[1], t.getWorkingCode())));
}
} else
c.addPiece(checkForNoChange(t, gen.new Piece((p.getValue().startsWith(corePath) ? corePath : "") + ref, t.getWorkingCode(), null)));
if (!mustSupportMode && isMustSupport(p) && e.getMustSupport()) {
c.addPiece(gen.new Piece(null, " ", null));
c.addStyledText(translate("sd.table", "This profile must be supported"), "S", "white", "red", null, false);
}
}
}
} else {
String tc = t.getWorkingCode();
if (Utilities.isAbsoluteUrl(tc)) {
StructureDefinition sd = context.fetchTypeDefinition(tc);
if (sd == null) {
c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, tc), tc, null)));
} else {
c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, tc), sd.getType(), null)));
}
} else if (pkp != null && pkp.hasLinkFor(tc)) {
c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, tc), tc, null)));
} else {
c.addPiece(checkForNoChange(t, gen.new Piece(null, tc, null)));
}
if (!mustSupportMode && isMustSupportDirect(t) && e.getMustSupport()) {
c.addPiece(gen.new Piece(null, " ", null));
c.addStyledText(translate("sd.table", "This type must be supported"), "S", "white", "red", null, false);
}
}
}
}
return c;
}
use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.
the class ImplementationGuide14_50 method convertImplementationGuide.
public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide();
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt);
if (src.hasUrlElement())
tgt.setUrlElement(Uri14_50.convertUri(src.getUrlElement()));
if (src.hasVersion())
tgt.setVersionElement(String14_50.convertString(src.getVersionElement()));
if (src.hasNameElement())
tgt.setNameElement(String14_50.convertString(src.getNameElement()));
if (src.hasStatus())
tgt.setStatusElement(Enumerations14_50.convertConformanceResourceStatus(src.getStatusElement()));
if (src.hasExperimental())
tgt.setExperimentalElement(Boolean14_50.convertBoolean(src.getExperimentalElement()));
if (src.hasPublisher())
tgt.setPublisherElement(String14_50.convertString(src.getPublisherElement()));
for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t));
if (src.hasDate())
tgt.setDateElement(DateTime14_50.convertDateTime(src.getDateElement()));
if (src.hasDescription())
tgt.setDescription(src.getDescription());
for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept())
tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t.getValueCodeableConcept()));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t));
if (src.hasCopyright())
tgt.setCopyright(src.getCopyright());
if (src.hasFhirVersion())
for (Enumeration<org.hl7.fhir.r5.model.Enumerations.FHIRVersion> v : src.getFhirVersion()) {
tgt.setFhirVersion(v.asStringValue());
}
for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) tgt.addDependency(convertImplementationGuideDependencyComponent(t));
for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) tgt.addPackage(convertImplementationGuidePackageComponent(t));
for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t));
for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t));
tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage()));
return tgt;
}
use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.
the class ExpansionProfile method setProperty.
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("url"))
// UriType
this.url = castToUri(value);
else if (name.equals("identifier"))
// Identifier
this.identifier = castToIdentifier(value);
else if (name.equals("version"))
// StringType
this.version = castToString(value);
else if (name.equals("name"))
// StringType
this.name = castToString(value);
else if (name.equals("status"))
// Enumeration<ConformanceResourceStatus>
this.status = new ConformanceResourceStatusEnumFactory().fromType(value);
else if (name.equals("experimental"))
// BooleanType
this.experimental = castToBoolean(value);
else if (name.equals("publisher"))
// StringType
this.publisher = castToString(value);
else if (name.equals("contact"))
this.getContact().add((ExpansionProfileContactComponent) value);
else if (name.equals("date"))
// DateTimeType
this.date = castToDateTime(value);
else if (name.equals("description"))
// StringType
this.description = castToString(value);
else if (name.equals("codeSystem"))
// ExpansionProfileCodeSystemComponent
this.codeSystem = (ExpansionProfileCodeSystemComponent) value;
else if (name.equals("includeDesignations"))
// BooleanType
this.includeDesignations = castToBoolean(value);
else if (name.equals("designation"))
// ExpansionProfileDesignationComponent
this.designation = (ExpansionProfileDesignationComponent) value;
else if (name.equals("includeDefinition"))
// BooleanType
this.includeDefinition = castToBoolean(value);
else if (name.equals("includeInactive"))
// BooleanType
this.includeInactive = castToBoolean(value);
else if (name.equals("excludeNested"))
// BooleanType
this.excludeNested = castToBoolean(value);
else if (name.equals("excludeNotForUI"))
// BooleanType
this.excludeNotForUI = castToBoolean(value);
else if (name.equals("excludePostCoordinated"))
// BooleanType
this.excludePostCoordinated = castToBoolean(value);
else if (name.equals("displayLanguage"))
// CodeType
this.displayLanguage = castToCode(value);
else if (name.equals("limitedExpansion"))
// BooleanType
this.limitedExpansion = castToBoolean(value);
else
super.setProperty(name, value);
}
use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.
the class DocumentManifest method setProperty.
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("masterIdentifier"))
// Identifier
this.masterIdentifier = castToIdentifier(value);
else if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("subject"))
// Reference
this.subject = castToReference(value);
else if (name.equals("recipient"))
this.getRecipient().add(castToReference(value));
else if (name.equals("type"))
// CodeableConcept
this.type = castToCodeableConcept(value);
else if (name.equals("author"))
this.getAuthor().add(castToReference(value));
else if (name.equals("created"))
// DateTimeType
this.created = castToDateTime(value);
else if (name.equals("source"))
// UriType
this.source = castToUri(value);
else if (name.equals("status"))
// Enumeration<DocumentReferenceStatus>
this.status = new DocumentReferenceStatusEnumFactory().fromType(value);
else if (name.equals("description"))
// StringType
this.description = castToString(value);
else if (name.equals("content"))
this.getContent().add((DocumentManifestContentComponent) value);
else if (name.equals("related"))
this.getRelated().add((DocumentManifestRelatedComponent) value);
else
super.setProperty(name, value);
}
use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.
the class EnrollmentResponse method setProperty.
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("request"))
// Reference
this.request = castToReference(value);
else if (name.equals("outcome"))
// Enumeration<RemittanceOutcome>
this.outcome = new RemittanceOutcomeEnumFactory().fromType(value);
else if (name.equals("disposition"))
// StringType
this.disposition = castToString(value);
else if (name.equals("ruleset"))
// Coding
this.ruleset = castToCoding(value);
else if (name.equals("originalRuleset"))
// Coding
this.originalRuleset = castToCoding(value);
else if (name.equals("created"))
// DateTimeType
this.created = castToDateTime(value);
else if (name.equals("organization"))
// Reference
this.organization = castToReference(value);
else if (name.equals("requestProvider"))
// Reference
this.requestProvider = castToReference(value);
else if (name.equals("requestOrganization"))
// Reference
this.requestOrganization = castToReference(value);
else
super.setProperty(name, value);
}
Aggregations