IBaseResource nextCandidateSource = subResourceList.get(i); for (ResourceReferenceInfo nextRef : ctx.newTerser().getAllResourceReferences(nextCandidateSource)) { String nextRefResourceType = nextRef.getResourceReference().getReferenceElement().getResourceType(); String nextRefIdPart = nextRef.getResourceReference().getReferenceElement().getIdPart(); if (isBlank(nextRefResourceType) || isBlank(nextRefIdPart)) { nextRef.getResourceReference().setResource(null); nextRef.getResourceReference().setReference(null); continue; nextRef.getResourceReference().setResource(null); nextRef.getResourceReference().setReference(nextTarget); if (checkedTargets.add(nextTarget) == false) { continue;
private static boolean payloadContainsNoPlaceholderReferences(FhirContext theCtx, IBaseResource theNewPayload) { List<ResourceReferenceInfo> refs = theCtx.newTerser().getAllResourceReferences(theNewPayload); for (ResourceReferenceInfo next : refs) { String ref = next.getResourceReference().getReferenceElement().getValue(); if (isBlank(ref)) { IBaseResource resource = next.getResourceReference().getResource(); if (resource != null) { ref = resource.getIdElement().getValue(); } } if (isNotBlank(ref)) { if (ref.startsWith("#")) { continue; } if (ref.startsWith("urn:uuid:")) { throw new AssertionError("Reference at " + next.getName() + " is invalid: " + ref); } } } return true; }
@Override public void acceptElement(IBaseResource theOuterResource, IBase theElement, List<String> thePathToElement, BaseRuntimeChildDefinition theChildDefinition, BaseRuntimeElementDefinition<?> theDefinition) { if (theElement == null || theElement.isEmpty()) { return; } if (IBaseReference.class.isAssignableFrom(theElement.getClass())) { retVal.add(new ResourceReferenceInfo(myContext, theOuterResource, thePathToElement, (IBaseReference) theElement)); } } });
public boolean matchesIncludeSet(Set<Include> theIncludes) { if (theIncludes == null) return false; for (Include include : theIncludes) { if (matchesInclude(include)) return true; } return false; }
public boolean matchesIncludeSet(Set<Include> theIncludes) { if (theIncludes == null) return false; for (Include include : theIncludes) { if (matchesInclude(include)) return true; } return false; }
String nextRef = nextRefInfo.getResourceReference().getReferenceElement().getValue(); if (isNotBlank(nextRef) && !sent.contains(nextRef)) { missingRef = nextRef;
IIdType nextId = nextRef.getResourceReference().getReferenceElement(); if (!nextId.hasIdPart()) { continue; IIdType newId = theIdSubstitutions.get(nextId); ourLog.debug(" * Replacing resource ref {} with {}", nextId, newId); nextRef.getResourceReference().setReference(newId.getValue()); } else if (nextId.getValue().startsWith("urn:")) { throw new InvalidRequestException("Unable to satisfy placeholder ID " + nextId.getValue() + " found in element named '" + nextRef.getName() + "' within resource of type: " + nextResource.getIdElement().getResourceType()); } else { ourLog.debug(" * Reference [{}] does not exist in bundle", nextId);
@Override public void acceptElement(IBaseResource theOuterResource, IBase theElement, List<String> thePathToElement, BaseRuntimeChildDefinition theChildDefinition, BaseRuntimeElementDefinition<?> theDefinition) { if (theElement == null || theElement.isEmpty()) { return; } if (IBaseReference.class.isAssignableFrom(theElement.getClass())) { retVal.add(new ResourceReferenceInfo(myContext, theOuterResource, thePathToElement, (IBaseReference) theElement)); } } });
IIdType nextRef = nextRefInfo.getResourceReference().getReferenceElement(); String resourceType = nextRef.getResourceType(); if (nextRef.isLocal()) { IBaseResource resource = nextRefInfo.getResourceReference().getResource(); if (resource instanceof ValueSet) { theWorkerCtx.getValueSets().put(nextRef.getValue(), (ValueSet) resource);
IIdType nextId = nextRef.getResourceReference().getReferenceElement(); if (!nextId.hasIdPart()) { continue; IIdType newId = theIdSubstitutions.get(nextId); ourLog.debug(" * Replacing resource ref {} with {}", nextId, newId); nextRef.getResourceReference().setReference(newId.getValue()); } else if (nextId.getValue().startsWith("urn:")) { throw new InvalidRequestException("Unable to satisfy placeholder ID " + nextId.getValue() + " found in element named '" + nextRef.getName() + "' within resource of type: " + nextResource.getIdElement().getResourceType()); } else { ourLog.debug(" * Reference [{}] does not exist in bundle", nextId);
List<ResourceReferenceInfo> refs = ctx.newTerser().getAllResourceReferences(next.getResource()); for (ResourceReferenceInfo nextRef : refs) { nextRef.getResourceReference().setResource(null); String value = nextRef.getResourceReference().getReferenceElement().toUnqualifiedVersionless().getValue(); if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) { ourLog.info("Discarding unknown reference: {}", value); nextRef.getResourceReference().getReferenceElement().setValue(null); } else { goodRefs++;
nextRef.getResourceReference().setResource(null); String value = nextRef.getResourceReference().getReferenceElement().toUnqualifiedVersionless().getValue(); if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) { ourLog.info("Discarding unknown reference: {}", value); nextRef.getResourceReference().getReferenceElement().setValue(null); } else { goodRefs++;
nextRef.getResourceReference().setResource(null); String value = nextRef.getResourceReference().getReferenceElement().toUnqualifiedVersionless().getValue(); if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) { ourLog.info("Discarding unknown reference: {}", value); nextRef.getResourceReference().getReferenceElement().setValue(null); } else { goodRefs++;
private static void copy(FhirContext theCtx, IGenericClient theTarget, String theResType, List<IBaseResource> theQueued, Set<String> theSent, Bundle theReceived) { for (Bundle.BundleEntryComponent nextEntry : theReceived.getEntry()) { Resource nextResource = nextEntry.getResource(); nextResource.setId(theResType + "/" + "CR-" + nextResource.getIdElement().getIdPart()); boolean haveUnsentReference = false; for (ResourceReferenceInfo nextRefInfo : theCtx.newTerser().getAllResourceReferences(nextResource)) { IIdType nextRef = nextRefInfo.getResourceReference().getReferenceElement(); if (nextRef.hasIdPart()) { String newRef = nextRef.getResourceType() + "/" + "CR-" + nextRef.getIdPart(); ourLog.info("Changing reference {} to {}", nextRef.getValue(), newRef); nextRefInfo.getResourceReference().setReference(newRef); if (!theSent.contains(newRef)) { haveUnsentReference = true; } } } if (haveUnsentReference) { ourLog.info("Queueing {} for delivery after", nextResource.getId()); theQueued.add(nextResource); continue; } IIdType newId = theTarget .update() .resource(nextResource) .execute() .getId(); ourLog.info("Copied resource {} and got ID {}", nextResource.getId(), newId); theSent.add(nextResource.getIdElement().toUnqualifiedVersionless().getValue()); } }
continue; IBaseResource nextRes = (IBaseResource) nextRefInfo.getResourceReference().getResource(); if (nextRes != null) { if (nextRes.getIdElement().hasIdPart()) {
IAnyResource nextRes = (IAnyResource) nextRefInfo.getResourceReference().getResource(); if (nextRes != null) { if (nextRes.getIdElement().hasIdPart()) {
continue; IResource nextRes = (IResource) nextRefInfo.getResourceReference().getResource(); if (nextRes != null) { if (nextRes.getId().hasIdPart()) {
IAnyResource nextRes = (IAnyResource) nextRefInfo.getResourceReference().getResource(); if (nextRes != null) { if (nextRes.getIdElement().hasIdPart()) {
List<ResourceReferenceInfo> refs = t.getAllResourceReferences(theResource); for (ResourceReferenceInfo nextRef : refs) { IIdType refId = nextRef.getResourceReference().getReferenceElement(); if (refId != null && refId.hasBaseUrl()) { if (getConfig().getTreatBaseUrlsAsLocal().contains(refId.getBaseUrl())) { IIdType newRefId = refId.toUnqualified(); nextRef.getResourceReference().setReference(newRefId.getValue());
IIdType nextRef = nextRefInfo.getResourceReference().getReferenceElement(); String resourceType = nextRef.getResourceType(); if (nextRef.isLocal()) { IBaseResource resource = nextRefInfo.getResourceReference().getResource(); if (resource instanceof ValueSet) { theWorkerCtx.getValueSets().put(nextRef.getValue(), (ValueSet) resource);