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 "??"; }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("entity")) { this.entity = new Reference(); return this.entity; } else if (name.equals("role")) { return addRole(); } else return super.addChild(name); }
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; }
public static Reference makeReference(String url) { Reference rr = new Reference(); rr.setReference(url); return rr; }
public static Reference makeReference(String url, String text) { Reference rr = new Reference(); rr.setReference(url); if (!Utilities.noString(text)) rr.setDisplay(text); return rr; }
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 boolean hasAuthorizingPrescription() { if (this.authorizingPrescription == null) return false; for (Reference item : this.authorizingPrescription) if (!item.isEmpty()) return true; return false; }
/** * 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()) { for (UriType tp : t.getProfile()) { if (tp.getValue().startsWith("#")) tp.setValue(url+t.getProfile()); } } } return element; }
private Questionnaire getQuestionnaire(QuestionnaireResponse theAnswers, Reference theQuestionnaireRef) { Questionnaire retVal; if (theQuestionnaireRef.getReferenceElement().isLocal()) { retVal = (Questionnaire) theQuestionnaireRef.getResource(); if (retVal == null) { for (Resource next : theAnswers.getContained()) { if (theQuestionnaireRef.getReferenceElement().getValue().equals(next.getId())) { retVal = (Questionnaire) next; } } } } else { retVal = myWorkerCtx.fetchResource(Questionnaire.class, theQuestionnaireRef.getReferenceElement().getValue()); } return retVal; }
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE)); String serverBase = getServerConfiguration().getServerAddressStrategy().determineServerBase(servletContext, theRequest); resource.getProfile().setReference((def.getResourceProfile(serverBase))); .setReference("OperationDefinition/" + opName); if (operationNames.add(opName)) { rest.addOperation().setName(methodBinding.getName()).getDefinition() .setReference("OperationDefinition/" + opName);
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 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 boolean hasSpecimen() { if (this.specimen == null) return false; for (Reference item : this.specimen) if (!item.isEmpty()) return true; return false; }
/** * 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()) { for (UriType tp : t.getProfile()) { if (tp.getValue().startsWith("#")) tp.setValue(url+t.getProfile()); } } } return element; }
public static Reference makeReference(String url) { Reference rr = new Reference(); rr.setReference(url); return rr; }
private ValueSet getValueSet(QuestionnaireResponse theAnswers, Reference theQuestionnaireRef) { ValueSet retVal; if (theQuestionnaireRef.getReferenceElement().isLocal()) { retVal = (ValueSet) theQuestionnaireRef.getResource(); if (retVal == null) { for (Resource next : theAnswers.getContained()) { if (theQuestionnaireRef.getReferenceElement().getValue().equals(next.getId())) { retVal = (ValueSet) next; } } } } else { retVal = myWorkerCtx.fetchResource(ValueSet.class, theQuestionnaireRef.getReferenceElement().getValue()); } return retVal; }
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE)); String serverBase = getServerConfiguration().getServerAddressStrategy().determineServerBase(servletContext, theRequest); resource.getProfile().setReference((def.getResourceProfile(serverBase))); .setReference("OperationDefinition/" + opName); if (operationNames.add(opName)) { rest.addOperation().setName(methodBinding.getName()).getDefinition() .setReference("OperationDefinition/" + opName);
/** * @return {@link #subject} (Who or what the composition is about. The composition can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of livestock, or a set of patients that share a common exposure).) */ public Reference getSubject() { if (this.subject == null) if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create Composition.subject"); else if (Configuration.doAutoCreate()) this.subject = new Reference(); // cc return this.subject; }
private CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { CanonicalType dst = new CanonicalType(src.getReference()); copyElement(src, dst); return dst; }
public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.r4.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; }