@Override public List<IBaseResource> toListOfResources() { ArrayList<IBaseResource> retVal = new ArrayList<IBaseResource>(); for (BundleEntryComponent next : myBundle.getEntry()) { if (next.getResource() != null) { retVal.add(next.getResource()); } else if (next.getResponse().getLocationElement().isEmpty() == false) { IdType id = new IdType(next.getResponse().getLocation()); String resourceType = id.getResourceType(); if (isNotBlank(resourceType)) { IAnyResource res = (IAnyResource) myContext.getResourceDefinition(resourceType).newInstance(); res.setId(id); retVal.add(res); } } } return retVal; }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("link")) { return addLink(); } else if (name.equals("fullUrl")) { throw new FHIRException("Cannot call addChild on a primitive type Bundle.fullUrl"); } else if (name.equals("resource")) { throw new FHIRException("Cannot call addChild on an abstract type Bundle.resource"); } else if (name.equals("search")) { this.search = new BundleEntrySearchComponent(); return this.search; } else if (name.equals("request")) { this.request = new BundleEntryRequestComponent(); return this.request; } else if (name.equals("response")) { this.response = new BundleEntryResponseComponent(); return this.response; } else return super.addChild(name); }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("link")) { return addLink(); } else if (name.equals("fullUrl")) { throw new FHIRException("Cannot call addChild on a primitive type Bundle.fullUrl"); } else if (name.equals("resource")) { throw new FHIRException("Cannot call addChild on an abstract type Bundle.resource"); } else if (name.equals("search")) { this.search = new BundleEntrySearchComponent(); return this.search; } else if (name.equals("request")) { this.request = new BundleEntryRequestComponent(); return this.request; } else if (name.equals("response")) { this.response = new BundleEntryResponseComponent(); return this.response; } else return super.addChild(name); }
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case -892481550: // status this.status = castToString(value); // StringType return value; case 1901043637: // location this.location = castToUri(value); // UriType return value; case 3123477: // etag this.etag = castToString(value); // StringType return value; case 1959003007: // lastModified this.lastModified = castToInstant(value); // InstantType return value; case -1106507950: // outcome this.outcome = castToResource(value); // Resource return value; default: return super.setProperty(hash, name, value); } }
@Override public List<IBaseResource> toListOfResources() { ArrayList<IBaseResource> retVal = new ArrayList<IBaseResource>(); for (BundleEntryComponent next : myBundle.getEntry()) { if (next.getResource() != null) { retVal.add(next.getResource()); } else if (next.getResponse().getLocationElement().isEmpty() == false) { IdType id = new IdType(next.getResponse().getLocation()); String resourceType = id.getResourceType(); if (isNotBlank(resourceType)) { IAnyResource res = (IAnyResource) myContext.getResourceDefinition(resourceType).newInstance(); res.setId(id); retVal.add(res); } } } return retVal; }
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("status")) { this.status = castToString(value); // StringType } else if (name.equals("location")) { this.location = castToUri(value); // UriType } else if (name.equals("etag")) { this.etag = castToString(value); // StringType } else if (name.equals("lastModified")) { this.lastModified = castToInstant(value); // InstantType } else if (name.equals("outcome")) { this.outcome = castToResource(value); // Resource } else return super.setProperty(name, value); return value; }
public boolean hasResponse() { return this.response != null && !this.response.isEmpty(); }
public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); copyElement(src, tgt); tgt.setStatus(src.getStatus()); if (src.hasLocation()) tgt.setLocation(src.getLocation()); if (src.hasEtag()) tgt.setEtag(src.getEtag()); if (src.hasLastModified()) tgt.setLastModified(src.getLastModified()); return tgt; }
public static org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent(); copyElement(src, tgt); tgt.setStatus(src.getStatus()); if (src.hasLocation()) tgt.setLocation(src.getLocation()); if (src.hasEtag()) tgt.setEtag(src.getEtag()); if (src.hasLastModified()) tgt.setLastModified(src.getLastModified()); return tgt; }
@Override public void setResponseETag(Bundle.BundleEntryComponent theEntry, String theEtag) { theEntry.getResponse().setEtag(theEtag); }
@Override public void setResponseStatus(Bundle.BundleEntryComponent theBundleEntry, String theStatus) { theBundleEntry.getResponse().setStatus(theStatus); }
@Override public void setResponseLocation(Bundle.BundleEntryComponent theEntry, String theResponseLocation) { theEntry.getResponse().setLocation(theResponseLocation); }
@Override public void setResponseLastModified(Bundle.BundleEntryComponent theBundleEntry, Date theLastModified) { theBundleEntry.getResponse().setLastModified(theLastModified); }
@Override public boolean enrichAuditDatasetFromResponse(Iti65AuditDataset auditDataset, Object response, AuditContext auditContext) { Bundle bundle = (Bundle) response; // Extract DocumentManifest (UU)IDs from the response bundle for auditing bundle.getEntry().stream() .map(Bundle.BundleEntryComponent::getResponse) .filter(Objects::nonNull) .filter(r -> r.getLocation() != null && r.getLocation().startsWith("DocumentManifest")) .findFirst() .ifPresent(r -> auditDataset.setDocumentManifestUuid(r.getLocation())); return super.enrichAuditDatasetFromResponse(auditDataset, response, auditContext); }
public BundleEntryResponseComponent copy() { BundleEntryResponseComponent dst = new BundleEntryResponseComponent(); copyValues(dst); dst.status = status == null ? null : status.copy(); dst.location = location == null ? null : location.copy(); dst.etag = etag == null ? null : etag.copy(); dst.lastModified = lastModified == null ? null : lastModified.copy(); dst.outcome = outcome == null ? null : outcome.copy(); return dst; }
/** * @return {@link #response} (Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.) */ public BundleEntryResponseComponent getResponse() { if (this.response == null) if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create BundleEntryComponent.response"); else if (Configuration.doAutoCreate()) this.response = new BundleEntryResponseComponent(); // cc return this.response; }
public org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent(); copyElement(src, tgt); tgt.setStatus(src.getStatus()); tgt.setLocation(src.getLocation()); tgt.setEtag(src.getEtag()); tgt.setLastModified(src.getLastModified()); return tgt; }