@Override public IOperationUnnamed onInstance(IIdType theId) { myId = theId.toVersionless(); return this; }
public static HttpGetClientInvocation createAbsoluteReadInvocation(FhirContext theContext, IIdType theId) { return new HttpGetClientInvocation(theContext, theId.toVersionless().getValue()); }
protected IBaseResource getAndMassagePayload(ResourceDeliveryMessage theMsg, CanonicalSubscription theSubscription) { IBaseResource payloadResource = theMsg.getPayload(myFhirContext); if (payloadResource == null || theSubscription.getRestHookDetails().isDeliverLatestVersion()) { IIdType payloadId = theMsg.getPayloadId(myFhirContext); try { payloadResource = myResourceRetriever.getResource(payloadId.toVersionless()); } catch (ResourceGoneException e) { ourLog.warn("Resource {} is deleted, not going to deliver for subscription {}", payloadId.toVersionless(), theSubscription.getIdElement(myFhirContext)); return null; } } IIdType resourceId = payloadResource.getIdElement(); if (theSubscription.getRestHookDetails().isStripVersionId()) { resourceId = resourceId.toVersionless(); payloadResource.setId(resourceId); } return payloadResource; }
@Override public IBaseResource getResource(IIdType payloadId) throws ResourceGoneException { RuntimeResourceDefinition resourceDef = myFhirContext.getResourceDefinition(payloadId.getResourceType()); IFhirResourceDao dao = myDaoRegistry.getResourceDao(resourceDef.getImplementingClass()); return dao.read(payloadId.toVersionless()); } }
private void populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { if (next.getIdElement().hasBaseUrl()) { entry.setFullUrl(next.getIdElement().toVersionless().getValue()); } else { if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { IIdType id = next.getIdElement().toVersionless(); id = id.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); entry.setFullUrl(id.getValue()); } } }
private IIdType populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { IIdType idElement = null; if (next.getIdElement().hasBaseUrl()) { idElement = next.getIdElement(); entry.setFullUrl(idElement.toVersionless().getValue()); } else { if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { idElement = next.getIdElement(); idElement = idElement.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); entry.setFullUrl(idElement.toVersionless().getValue()); } } return idElement; }
private IIdType populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { IIdType idElement = null; if (next.getIdElement().hasBaseUrl()) { idElement = next.getIdElement(); entry.setFullUrl(idElement.toVersionless().getValue()); } else { if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { idElement = next.getIdElement(); idElement = idElement.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); entry.setFullUrl(idElement.toVersionless().getValue()); } } return idElement; }
@Override @Transactional(propagation = Propagation.NEVER) public ExpungeOutcome expunge(IIdType theId, ExpungeOptions theExpungeOptions) { TransactionTemplate txTemplate = new TransactionTemplate(myPlatformTransactionManager); BaseHasResource entity = txTemplate.execute(t->readEntity(theId)); if (theId.hasVersionIdPart()) { BaseHasResource currentVersion; currentVersion = txTemplate.execute(t->readEntity(theId.toVersionless())); if (entity.getVersion() == currentVersion.getVersion()) { throw new PreconditionFailedException("Can not perform version-specific expunge of resource " + theId.toUnqualified().getValue() + " as this is the current version"); } return doExpunge(getResourceName(), entity.getResourceId(), entity.getVersion(), theExpungeOptions); } return doExpunge(getResourceName(), entity.getResourceId(), null, theExpungeOptions); }
@Override public IOperationUnnamed onInstance(IIdType theId) { myId = theId.toVersionless(); return this; }
private boolean activateSubscription(String theActiveStatus, final IBaseResource theSubscription, String theRequestedStatus) { IFhirResourceDao subscriptionDao = myDaoRegistry.getSubscriptionDao(); IBaseResource subscription = subscriptionDao.read(theSubscription.getIdElement()); subscription.setId(subscription.getIdElement().toVersionless()); ourLog.info("Activating subscription {} from status {} to {}", subscription.getIdElement().toUnqualified().getValue(), theRequestedStatus, theActiveStatus); try { SubscriptionUtil.setStatus(myFhirContext, subscription, theActiveStatus); subscription = subscriptionDao.update(subscription).getResource(); submitResourceModifiedForUpdate(subscription); return true; } catch (final UnprocessableEntityException e) { ourLog.info("Changing status of {} to ERROR", subscription.getIdElement()); SubscriptionUtil.setStatus(myFhirContext, subscription, "error"); SubscriptionUtil.setReason(myFhirContext, subscription, e.getMessage()); subscriptionDao.update(subscription); return false; } }
reference = refId.toVersionless().getValue(); } else { reference = refId.getValue(); return ref.toVersionless().getValue();
public static HttpGetClientInvocation createAbsoluteReadInvocation(FhirContext theContext, IIdType theId) { return new HttpGetClientInvocation(theContext, theId.toVersionless().getValue()); }
@Override public IBaseResource getResource(IIdType payloadId) throws ResourceGoneException { RuntimeResourceDefinition resourceDef = myFhirContext.getResourceDefinition(payloadId.getResourceType()); IFhirResourceDao dao = myDaoRegistry.getResourceDao(resourceDef.getImplementingClass()); return dao.read(payloadId.toVersionless()); } }
private void populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { if (next.getIdElement().hasBaseUrl()) { entry.setFullUrl(next.getIdElement().toVersionless().getValue()); } else { if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { IIdType id = next.getIdElement().toVersionless(); id = id.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); entry.setFullUrl(id.getValue()); } } }
private IIdType populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { IIdType idElement = null; if (next.getIdElement().hasBaseUrl()) { idElement = next.getIdElement(); entry.setFullUrl(idElement.toVersionless().getValue()); } else { if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { idElement = next.getIdElement(); idElement = idElement.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); entry.setFullUrl(idElement.toVersionless().getValue()); } } return idElement; }
private IIdType populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { IIdType idElement = null; if (next.getIdElement().hasBaseUrl()) { idElement = next.getIdElement(); entry.setFullUrl(idElement.toVersionless().getValue()); } else { if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { idElement = next.getIdElement(); idElement = idElement.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); entry.setFullUrl(idElement.toVersionless().getValue()); } } return idElement; }
private IIdType populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { IIdType idElement = null; if (next.getIdElement().hasBaseUrl()) { idElement = next.getIdElement(); entry.setFullUrl(idElement.toVersionless().getValue()); } else { if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { idElement = next.getIdElement(); idElement = idElement.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); entry.setFullUrl(idElement.toVersionless().getValue()); } } return idElement; }
@Override @Transactional(propagation = Propagation.NEVER) public ExpungeOutcome expunge(IIdType theId, ExpungeOptions theExpungeOptions) { TransactionTemplate txTemplate = new TransactionTemplate(myPlatformTransactionManager); BaseHasResource entity = txTemplate.execute(t->readEntity(theId)); if (theId.hasVersionIdPart()) { BaseHasResource currentVersion; currentVersion = txTemplate.execute(t->readEntity(theId.toVersionless())); if (entity.getVersion() == currentVersion.getVersion()) { throw new PreconditionFailedException("Can not perform version-specific expunge of resource " + theId.toUnqualified().getValue() + " as this is the current version"); } return doExpunge(getResourceName(), entity.getResourceId(), entity.getVersion(), theExpungeOptions); } return doExpunge(getResourceName(), entity.getResourceId(), null, theExpungeOptions); }
private boolean activateSubscription(String theActiveStatus, final IBaseResource theSubscription, String theRequestedStatus) { IFhirResourceDao subscriptionDao = myDaoRegistry.getSubscriptionDao(); IBaseResource subscription = subscriptionDao.read(theSubscription.getIdElement()); subscription.setId(subscription.getIdElement().toVersionless()); ourLog.info("Activating subscription {} from status {} to {}", subscription.getIdElement().toUnqualified().getValue(), theRequestedStatus, theActiveStatus); try { SubscriptionUtil.setStatus(myFhirContext, subscription, theActiveStatus); subscription = subscriptionDao.update(subscription).getResource(); submitResourceModifiedForUpdate(subscription); return true; } catch (final UnprocessableEntityException e) { ourLog.info("Changing status of {} to ERROR", subscription.getIdElement()); SubscriptionUtil.setStatus(myFhirContext, subscription, "error"); SubscriptionUtil.setReason(myFhirContext, subscription, e.getMessage()); subscriptionDao.update(subscription); return false; } }
reference = refId.toVersionless().getValue(); } else { reference = refId.getValue(); return ref.toVersionless().getValue();