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; }
List<IBaseReference> allRefs = terser.getAllPopulatedChildElementsOfType(theResource, IBaseReference.class); for (IBaseReference nextRef : allRefs) { IIdType nextId = nextRef.getReferenceElement(); String nextIdText = nextId.getValue(); if (nextIdText == null) { String newId = myIdHelperService.translatePidIdToForcedId(resourceTypeString, next); ourLog.debug("Replacing inline match URL[{}] with ID[{}}", nextId.getValue(), newId); nextRef.setReference(newId);
if (nextObject instanceof IBaseReference) { IBaseReference nextValue = (IBaseReference) nextObject; if (nextValue.isEmpty()) { return; nextId = nextValue.getReferenceElement(); if (nextId.isEmpty() && nextValue.getResource() != null) { nextId = nextValue.getResource().getIdElement();
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;
continue; IBaseResource nextRes = (IBaseResource) nextRefInfo.getResourceReference().getResource(); if (nextRes != null) { if (nextRes.getIdElement().hasIdPart()) {
@Override public String toString() { ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); b.append("name", myName); b.append("resource", myResource.getReferenceElement()); return b.build(); }
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++;
public static void setSecurityContext(FhirContext theCtx, IBaseBinary theBinary, String theSecurityContext) { RuntimeResourceDefinition def = theCtx.getResourceDefinition("Binary"); BaseRuntimeChildDefinition child = def.getChildByName("securityContext"); BaseRuntimeElementDefinition<?> referenceDef = theCtx.getElementDefinition("reference"); IBaseReference reference = (IBaseReference) referenceDef.newInstance(); child.getMutator().addValue(theBinary, reference); reference.setReference(theSecurityContext); }
IBaseResource nextRes = (IBaseResource) nextRef.getResource(); if (nextRes != null) { if (nextRes.getIdElement().hasIdPart()) {
String nextRef = nextComponent.getReference().getReferenceElement().toUnqualifiedVersionless().getValue(); RuntimeSearchParam componentTarget = idToRuntimeSearchParam.get(nextRef); if (componentTarget != null) {
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++;
public static void setSecurityContext(FhirContext theCtx, IBaseBinary theBinary, String theSecurityContext) { RuntimeResourceDefinition def = theCtx.getResourceDefinition("Binary"); BaseRuntimeChildDefinition child = def.getChildByName("securityContext"); BaseRuntimeElementDefinition<?> referenceDef = theCtx.getElementDefinition("reference"); IBaseReference reference = (IBaseReference) referenceDef.newInstance(); child.getMutator().addValue(theBinary, reference); reference.setReference(theSecurityContext); }
IIdType nextTargetId = nextValue.getReferenceElement(); String nextRef = nextTargetId.toUnqualifiedVersionless().getValue(); if (isBlank(nextRef) && nextValue.getResource() != null) { IBaseResource nextTarget = nextValue.getResource(); nextTargetId = nextTarget.getIdElement().toUnqualifiedVersionless(); if (!nextTargetId.hasResourceType()) {
IBaseResource target = ((IBaseReference) theElement).getResource(); if (target != null) { if (target.getIdElement().hasIdPart() == false || target.getIdElement().isLocal()) {
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()); } }
String nextRef = nextRefInfo.getResourceReference().getReferenceElement().getValue(); if (isNotBlank(nextRef) && !sent.contains(nextRef)) { missingRef = nextRef;
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++;
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);
IAnyResource nextRes = (IAnyResource) nextRefInfo.getResourceReference().getResource(); if (nextRes != null) { if (nextRes.getIdElement().hasIdPart()) {
IBaseReference nextRef = (IBaseReference) next; String refText = determineReferenceText(nextRef, theCompositeChildElement); if (!StringUtils.equals(refText, nextRef.getReferenceElement().getValue())) { newRef.setReference(refText); retVal.set(i, newRef);