@Override public String toString() { org.apache.commons.lang3.builder.ToStringBuilder b = new org.apache.commons.lang3.builder.ToStringBuilder(this, org.apache.commons.lang3.builder.ToStringStyle.SHORT_PREFIX_STYLE); b.append("reference", getReference().getValueAsString()); b.append("loaded", getResource() != null); return b.toString(); }
@Override public boolean isEmpty() { return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myReference, myDisplay); }
public BaseResourceReferenceDt setReference(IIdType theReference) { if (theReference instanceof IdDt) { setReference((IdDt) theReference); } else if (theReference != null) { setReference(new IdDt(theReference.getValue())); } else { setReference((IdDt) null); } return this; }
List<BaseResourceReferenceDt> refs = myContext.newTerser().getAllPopulatedChildElementsOfType(theResource, BaseResourceReferenceDt.class); for (BaseResourceReferenceDt nextRef : refs) { if (nextRef.getReference().isEmpty() == false) { if (nextRef.getReference().hasVersionIdPart()) { nextRef.setReference(nextRef.getReference().toUnqualifiedVersionless());
IResource nextRes = (IResource) nextRef.getResource(); if (nextRes != null) { if (nextRes.getId().hasIdPart()) {
/** * Returns the referenced resource, fetching it <b>if it has not already been loaded</b>. This method invokes the * HTTP client to retrieve the resource unless it has already been loaded, or was a contained resource in which case * it is simply returned. */ public IBaseResource loadResource(IRestfulClient theClient) { if (myResource != null) { return myResource; } IdDt resourceId = getReference(); if (resourceId == null || isBlank(resourceId.getValue())) { throw new IllegalStateException("Reference has no resource ID defined"); } if (isBlank(resourceId.getBaseUrl()) || isBlank(resourceId.getResourceType())) { throw new IllegalStateException("Reference is not complete (must be in the form [baseUrl]/[resource type]/[resource ID]) - Reference is: " + resourceId.getValue()); } String resourceUrl = resourceId.getValue(); ourLog.debug("Loading resource at URL: {}", resourceUrl); RuntimeResourceDefinition definition = theClient.getFhirContext().getResourceDefinition(resourceId.getResourceType()); Class<? extends IBaseResource> resourceType = definition.getImplementingClass(); myResource = theClient.fetchResourceFromUrl(resourceType, resourceUrl); myResource.setId(resourceUrl); return myResource; }
IdDt nextId = nextRef.getReference(); if (!nextId.hasIdPart()) { continue; IdDt newId = theIdSubstitutions.get(nextId); ourLog.debug(" * Replacing resource ref {} with {}", nextId, newId); nextRef.setReference(newId); } else { ourLog.debug(" * Reference [{}] does not exist in bundle", nextId);
IBaseResource nextRefRes = nextRef.getResource(); if (nextRefRes != null) { if (nextRefRes.getIdElement().hasIdPart()) {
/** * Returns the referenced resource, fetching it <b>if it has not already been loaded</b>. This method invokes the * HTTP client to retrieve the resource unless it has already been loaded, or was a contained resource in which case * it is simply returned. */ public IBaseResource loadResource(IRestfulClient theClient) { if (myResource != null) { return myResource; } IdDt resourceId = getReference(); if (resourceId == null || isBlank(resourceId.getValue())) { throw new IllegalStateException("Reference has no resource ID defined"); } if (isBlank(resourceId.getBaseUrl()) || isBlank(resourceId.getResourceType())) { throw new IllegalStateException("Reference is not complete (must be in the form [baseUrl]/[resource type]/[resource ID]) - Reference is: " + resourceId.getValue()); } String resourceUrl = resourceId.getValue(); ourLog.debug("Loading resource at URL: {}", resourceUrl); RuntimeResourceDefinition definition = theClient.getFhirContext().getResourceDefinition(resourceId.getResourceType()); Class<? extends IBaseResource> resourceType = definition.getImplementingClass(); myResource = theClient.fetchResourceFromUrl(resourceType, resourceUrl); myResource.setId(resourceUrl); return myResource; }
@Override public String toString() { org.apache.commons.lang3.builder.ToStringBuilder b = new org.apache.commons.lang3.builder.ToStringBuilder(this, org.apache.commons.lang3.builder.ToStringStyle.SHORT_PREFIX_STYLE); b.append("reference", getReference().getValueAsString()); b.append("loaded", getResource() != null); return b.toString(); }
List<BaseResourceReferenceDt> refs = myContext.newTerser().getAllPopulatedChildElementsOfType(theResource, BaseResourceReferenceDt.class); for (BaseResourceReferenceDt nextRef : refs) { if (nextRef.getReference().isEmpty() == false) { if (nextRef.getReference().hasVersionIdPart()) { nextRef.setReference(nextRef.getReference().toUnqualifiedVersionless());
IResource nextRes = (IResource) nextRef.getResource(); if (nextRes != null) { if (nextRes.getId().hasIdPart()) {
@Override public boolean isEmpty() { return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myReference, myDisplay); }
/** * Constructor * * @param theResource * The loaded resource itself */ public BaseResourceReferenceDt(IResource theResource) { myResource = theResource; setReference(theResource.getId()); }
IdDt nextId = nextRef.getReference(); if (!nextId.hasIdPart()) { continue; IdDt newId = theIdSubstitutions.get(nextId); ourLog.debug(" * Replacing resource ref {} with {}", nextId, newId); nextRef.setReference(newId); } else { ourLog.debug(" * Reference [{}] does not exist in bundle", nextId);
@Override public boolean isEmpty() { return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myReference, myDisplay); }
public BaseResourceReferenceDt setReference(IIdType theReference) { if (theReference instanceof IdDt) { setReference((IdDt) theReference); } else if (theReference != null) { setReference(new IdDt(theReference.getValue())); } else { setReference((IdDt) null); } return this; }
/** * Constructor * * @param theResource * The loaded resource itself */ public BaseResourceReferenceDt(IResource theResource) { myResource = theResource; setReference(theResource.getId()); }