private String describeReference(Type reference) { if (reference == null) return "null"; if (reference instanceof UriType) return ((UriType) reference).getValue(); if (reference instanceof Reference) return ((Reference) reference).getReference(); return "??"; }
public org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); copyElement(src, tgt); tgt.setReference(src.getReference()); tgt.setDisplay(src.getDisplay()); return tgt; }
private ValueSet getValueSet(QuestionnaireResponse theResponse, Reference theQuestionnaireRef) { ValueSet retVal; if (theQuestionnaireRef.getReferenceElement().isLocal()) { retVal = (ValueSet) theQuestionnaireRef.getResource(); if (retVal == null) { for (Resource next : theResponse.getContained()) { if (theQuestionnaireRef.getReferenceElement().getValue().equals(next.getId())) { retVal = (ValueSet) next; } } } } else { retVal = myWorkerCtx.fetchResource(ValueSet.class, theQuestionnaireRef.getReferenceElement().getValue()); } return retVal; }
public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); copyElement(src, tgt); if (src.hasReference()) tgt.setReference(src.getReference()); if (src.hasDisplay()) tgt.setDisplay(src.getDisplay()); return tgt; }
private Reference readAsReference(Element item) { Reference r = new Reference(); r.setDisplay(item.getNamedChildValue("display")); r.setReference(item.getNamedChildValue("reference")); List<Element> identifier = item.getChildrenByName("identifier"); if (identifier.isEmpty() == false) { r.setIdentifier(readAsIdentifier(identifier.get(0))); } return r; } private Identifier readAsIdentifier(Element item) {
public Reference addUdi() { //3 Reference t = new Reference(); if (this.udi == null) this.udi = new ArrayList<Reference>(); this.udi.add(t); return t; }
private String getSubjectReference(Resource resource, Function<Resource, Reference> f) { Reference reference = f.apply(resource); if (reference == null) { throw FhirUtils.unprocessableEntity( OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.UNKNOWN_PATIENT_ID.getOpcode(), null, "Empty Patient reference in resource %s", resource ); } // Could be contained resources if (reference.getResource() != null) { Patient patient = (Patient) reference.getResource(); return patient.getIdentifier().get(0).getValue(); } return reference.getReference(); }
public org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); copyElement(src, tgt); tgt.setRole(convertProvenanceEntityRole(src.getRole())); if (src.hasReference()) tgt.setWhat(new org.hl7.fhir.dstu3.model.Reference().setReference(src.getReference())); tgt.addAgent(convertProvenanceAgentComponent(src.getAgent())); return tgt; }
public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Reference tgt = new org.hl7.fhir.instance.model.Reference(); copyElement(src, tgt); tgt.setReference(src.getReference()); tgt.setDisplay(src.getDisplay()); return tgt; }
private void checkReference(Object appContext, List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition container, String parentType, NodeStack stack) throws FHIRException, IOException { Reference reference = readAsReference(element); String ref = reference.getReference(); if (Utilities.noString(ref)) { if (Utilities.noString(reference.getIdentifier().getSystem()) && Utilities.noString(reference.getIdentifier().getValue())) { warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, !Utilities.noString(element.getNamedChildValue("display")), "A Reference without an actual reference or identifier should have a display");
/** * @return fhir patient. */ public Patient getPatient() { return (Patient) _mainPatientRef.getResource(); }
/** * Finds internal references in an Element's Binding and StructureDefinition references (in TypeRef) and bases them on the given url * @param url - the base url to use to turn internal references into absolute references * @param element - the Element to update * @return - the updated Element */ private ElementDefinition updateURLs(String url, ElementDefinition element) { if (element != null) { ElementDefinition defn = element; if (defn.hasBinding() && defn.getBinding().getValueSet() instanceof Reference && ((Reference)defn.getBinding().getValueSet()).getReference().startsWith("#")) ((Reference)defn.getBinding().getValueSet()).setReference(url+((Reference)defn.getBinding().getValueSet()).getReference()); for (TypeRefComponent t : defn.getType()) { if (t.hasProfile()) { if (t.getProfile().startsWith("#")) t.setProfile(url+t.getProfile()); } if (t.hasTargetProfile()) { if (t.getTargetProfile().startsWith("#")) t.setTargetProfile(url+t.getTargetProfile()); } } } return element; }
public org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent(); copyElement(src, tgt); tgt.setRole(convertProvenanceEntityRole(src.getRole())); if (src.hasWhatReference() && src.getWhatReference().hasReference()) tgt.setReference(src.getWhatReference().getReference()); for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.setAgent(convertProvenanceAgentComponent(t)); return tgt; }
@Search() public List<DiagnosticReport> getDiagnosticReport( @RequiredParam(name=DiagnosticReport.SP_IDENTIFIER) TokenParam theIdentifier, @IncludeParam(allow= {"DiagnosticReport:subject"}) String theInclude ) { List<DiagnosticReport> retVal = new ArrayList<DiagnosticReport>(); // Assume this method exists and loads the report from the DB DiagnosticReport report = loadSomeDiagnosticReportFromDatabase(theIdentifier); // If the client has asked for the subject to be included: if ("DiagnosticReport:subject".equals(theInclude)) { // The resource reference should contain the ID of the patient IIdType subjectId = report.getSubject().getReferenceElement(); // So load the patient ID and return it Patient subject = loadSomePatientFromDatabase(subjectId); report.getSubject().setResource(subject); } retVal.add(report); return retVal; } //END SNIPPET: pathSpecSimple
public org.hl7.fhir.dstu3.model.Media convertMedia(org.hl7.fhir.instance.model.Media src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Media tgt = new org.hl7.fhir.dstu3.model.Media(); copyDomainResource(src, tgt); for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); tgt.setType(convertDigitalMediaType(src.getType())); tgt.setSubtype(convertCodeableConcept(src.getSubtype())); tgt.setView(convertCodeableConcept(src.getView())); tgt.setSubject(convertReference(src.getSubject())); tgt.setOperator(convertReference(src.getOperator())); tgt.getDevice().setDisplay(src.getDeviceName()); tgt.setHeight(src.getHeight()); tgt.setWidth(src.getWidth()); tgt.setFrames(src.getFrames()); tgt.setDuration(src.getDuration()); tgt.setContent(convertAttachment(src.getContent())); return tgt; }
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case -925155509: return getReferenceElement_(); case -1618432855: return getIdentifier(); case 1671764162: return getDisplayElement(); default: return super.makeProperty(hash, name); } }
/** * Convenience setter which sets the reference to the complete {@link IIdType#getValue() value} of the given * reference. * * @param theReference The reference, or <code>null</code> * @return * @return Returns a reference to this */ public Reference setReferenceElement(IIdType theReference) { if (theReference != null) { setReference(theReference.getValue()); } else { setReference(null); } return this; } protected void listChildren(List<Property> children) {
public Reference addBasedOn() { //3 Reference t = new Reference(); if (this.basedOn == null) this.basedOn = new ArrayList<Reference>(); this.basedOn.add(t); return t; }
private Reference readAsReference(Element item) { Reference r = new Reference(); r.setDisplay(item.getNamedChildValue("display")); r.setReference(item.getNamedChildValue("reference")); List<Element> identifier = item.getChildrenByName("identifier"); if (identifier.isEmpty() == false) { r.setIdentifier(readAsIdentifier(identifier.get(0))); } return r; } private Identifier readAsIdentifier(Element item) {
public void enrichDatasetFromDocumentManifest(DocumentManifest documentManifest) { Reference reference = documentManifest.getSubject(); getPatientIds().add(reference.getResource() != null ? reference.getResource().getIdElement().getValue() : reference.getReference()); // If available, use the documentManifest identifier as documentManifestUuid if (!documentManifest.getIdentifier().isEmpty()) { this.documentManifestUuid = documentManifest.getIdentifier().get(0).getValue(); } } }