public HttpPatchClientInvocation(FhirContext theContext, IIdType theId, String theContentType, String theContents) { super(theContext); myUrlPath = theId.toUnqualifiedVersionless().getValue(); myContentType = theContentType; myContents = theContents; }
public HttpDeleteClientInvocation(FhirContext theContext, IIdType theId) { super(theContext); myUrlPath = theId.toUnqualifiedVersionless().getValue(); }
public void setIdElement(IIdType theIdElement) { myIdElement = null; if (theIdElement != null) { myIdElement = theIdElement.toUnqualifiedVersionless().getValue(); } }
private IBaseResource findResource(Map<String, IBaseResource> theCandidateResources, IIdType theId) { IBaseResource retVal = theCandidateResources.get(theId.toUnqualifiedVersionless().getValue()); if (retVal == null) { throw new InternalErrorException("Unknown reference in ImplementationGuide: " + theId); } return retVal; }
private String getId(ActiveSubscription theActiveSubscription) { return theActiveSubscription.getIdElement(myFhirContext).toUnqualifiedVersionless().getValue(); }
private void filterBundle(org.hl7.fhir.dstu3.model.Bundle theBundle) { for (Iterator<BundleEntryComponent> iter = theBundle.getEntry().iterator(); iter.hasNext(); ) { IBaseResource next = iter.next().getResource(); for (IIdType nextExclude : myExcludes) { if (nextExclude.hasResourceType() && nextExclude.toUnqualifiedVersionless().getValue().equals(next.getIdElement().toUnqualifiedVersionless().getValue())) { iter.remove(); continue; } else if (nextExclude.getIdPart().equals(next.getIdElement().getIdPart())) { iter.remove(); continue; } } } }
private void filterBundle(ca.uhn.fhir.model.dstu2.resource.Bundle theBundle) { for (Iterator<Entry> iter = theBundle.getEntry().iterator(); iter.hasNext(); ) { IBaseResource next = iter.next().getResource(); for (IIdType nextExclude : myExcludes) { if (nextExclude.hasResourceType() && nextExclude.toUnqualifiedVersionless().getValue().equals(next.getIdElement().toUnqualifiedVersionless().getValue())) { iter.remove(); continue; } else if (nextExclude.getIdPart().equals(next.getIdElement().getIdPart())) { iter.remove(); continue; } } } }
private void filterBundle(org.hl7.fhir.r4.model.Bundle theBundle) { for (Iterator<org.hl7.fhir.r4.model.Bundle.BundleEntryComponent> iter = theBundle.getEntry().iterator(); iter.hasNext(); ) { IBaseResource next = iter.next().getResource(); for (IIdType nextExclude : myExcludes) { if (nextExclude.hasResourceType() && nextExclude.toUnqualifiedVersionless().getValue().equals(next.getIdElement().toUnqualifiedVersionless().getValue())) { iter.remove(); continue; } else if (nextExclude.getIdPart().equals(next.getIdElement().getIdPart())) { iter.remove(); continue; } } } }
private Future<Void> submitResource(String theSubscriptionId, IBaseResource theResourceToTrigger) { ourLog.info("Submitting resource {} to subscription {}", theResourceToTrigger.getIdElement().toUnqualifiedVersionless().getValue(), theSubscriptionId); ResourceModifiedMessage msg = new ResourceModifiedMessage(myFhirContext, theResourceToTrigger, ResourceModifiedMessage.OperationTypeEnum.UPDATE); msg.setSubscriptionId(new IdType(theSubscriptionId).toUnqualifiedVersionless().getValue()); return myExecutorService.submit(() -> { for (int i = 0; ; i++) { try { myResourceModifiedConsumer.submitResourceModified(msg); break; } catch (Exception e) { if (i >= 3) { throw new InternalErrorException(e); } ourLog.warn("Exception while retriggering subscriptions (going to sleep and retry): {}", e.toString()); Thread.sleep(1000); } } return null; }); }
sent.add(nextQueued.getIdElement().toUnqualifiedVersionless().getValue()); queued.remove(nextQueued);
@Override public IBundleProvider history(final IIdType theId, final Date theSince, Date theUntil, RequestDetails theRequestDetails) { // Notify interceptors ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, getResourceName(), theId); notifyInterceptors(RestOperationTypeEnum.HISTORY_INSTANCE, requestDetails); StopWatch w = new StopWatch(); IIdType id = theId.withResourceType(myResourceName).toUnqualifiedVersionless(); BaseHasResource entity = readEntity(id); IBundleProvider retVal = super.history(myResourceName, entity.getId(), theSince, theUntil); ourLog.debug("Processed history on {} in {}ms", id, w.getMillisAndRestart()); return retVal; }
public BUNDLE collection(final RequestDetails theRequestDetails, BUNDLE theRequest) { String transactionType = myVersionAdapter.getBundleType(theRequest); if (!org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION.toCode().equals(transactionType)) { throw new InvalidRequestException("Can not process collection Bundle of type: " + transactionType); } ourLog.info("Beginning storing collection with {} resources", myVersionAdapter.getEntries(theRequest).size()); long start = System.currentTimeMillis(); TransactionTemplate txTemplate = new TransactionTemplate(myTxManager); txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); BUNDLE resp = myVersionAdapter.createBundle(org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE.toCode()); List<IBaseResource> resources = new ArrayList<>(); for (final BUNDLEENTRY nextRequestEntry : myVersionAdapter.getEntries(theRequest)) { IBaseResource resource = myVersionAdapter.getResource(nextRequestEntry); resources.add(resource); } BUNDLE transactionBundle = myVersionAdapter.createBundle("transaction"); for (IBaseResource next : resources) { BUNDLEENTRY entry = myVersionAdapter.addEntry(transactionBundle); myVersionAdapter.setResource(entry, next); myVersionAdapter.setRequestVerb(entry, "PUT"); myVersionAdapter.setRequestUrl(entry, next.getIdElement().toUnqualifiedVersionless().getValue()); } transaction(theRequestDetails, transactionBundle); return resp; }
jobDetails.setRemainingSearchUrls(searchUrls.stream().map(StringParam::getValue).collect(Collectors.toList())); if (theSubscriptionId != null) { jobDetails.setSubscriptionId(theSubscriptionId.toUnqualifiedVersionless().getValue());
private void handleTransactionCreateOrUpdateOutcome(Map<IIdType, IIdType> idSubstitutions, Map<IIdType, DaoMethodOutcome> idToPersistedOutcome, IIdType nextResourceId, DaoMethodOutcome outcome, BUNDLEENTRY newEntry, String theResourceType, IBaseResource theRes, ServletRequestDetails theRequestDetails) { IIdType newId = outcome.getId().toUnqualifiedVersionless(); IIdType resourceId = isPlaceholder(nextResourceId) ? nextResourceId : nextResourceId.toUnqualifiedVersionless(); if (newId.equals(resourceId) == false) { idSubstitutions.put(resourceId, newId);
private static void handleTransactionCreateOrUpdateOutcome(Map<IdDt, IdDt> idSubstitutions, Map<IdDt, DaoMethodOutcome> idToPersistedOutcome, IdDt nextResourceId, DaoMethodOutcome outcome, Entry newEntry, String theResourceType, IResource theRes) { IdDt newId = (IdDt) outcome.getId().toUnqualifiedVersionless(); IdDt resourceId = isPlaceholder(nextResourceId) ? nextResourceId : nextResourceId.toUnqualifiedVersionless(); if (newId.equals(resourceId) == false) { idSubstitutions.put(resourceId, newId); if (isPlaceholder(resourceId)) { /* * The correct way for substitution IDs to be is to be with no resource type, but we'll accept the qualified kind too just to be lenient. */ idSubstitutions.put(new IdDt(theResourceType + '/' + resourceId.getValue()), newId); } } idToPersistedOutcome.put(newId, outcome); if (outcome.getCreated().booleanValue()) { newEntry.getResponse().setStatus(toStatusString(Constants.STATUS_HTTP_201_CREATED)); } else { newEntry.getResponse().setStatus(toStatusString(Constants.STATUS_HTTP_200_OK)); } newEntry.getResponse().setLastModified(ResourceMetadataKeyEnum.UPDATED.get(theRes)); }
throw new ResourceNotFoundException(getContext().getLocalizer().getMessage(BaseHapiFhirResourceDao.class, "invalidVersion", theId.getVersionIdPart(), theId.toUnqualifiedVersionless())); entity = q.getSingleResult(); } catch (NoResultException e) { throw new ResourceNotFoundException(getContext().getLocalizer().getMessage(BaseHapiFhirResourceDao.class, "invalidVersion", theId.getVersionIdPart(), theId.toUnqualifiedVersionless()));
@Override public void send(EmailDetails theDetails) { String subscriptionId = theDetails.getSubscription().toUnqualifiedVersionless().getValue(); StopWatch sw = new StopWatch();
resourceId.toUnqualifiedVersionless().getValue(), matchResult.isInMemory() ? "in-memory" : "by querying the repository");
ourLog.info("Delivering {} rest-hook payload {} for {}", theMsg.getOperationType(), thePayloadResource.getIdElement().toUnqualified().getValue(), theSubscription.getIdElement(myFhirContext).toUnqualifiedVersionless().getValue());
return ref.toUnqualifiedVersionless().getValue();