public boolean unregisterSubscriptionIfRegistered(IBaseResource theSubscription, String theStatusString) { if (hasSubscription(theSubscription.getIdElement()).isPresent()) { ourLog.info("Removing {} subscription {}", theStatusString, theSubscription.getIdElement().toUnqualified().getValue()); unregisterSubscription(theSubscription.getIdElement()); return true; } return false; }
private void submitResourceModified(final ResourceModifiedMessage theMsg) { switch (theMsg.getOperationType()) { case DELETE: mySubscriptionRegistry.unregisterSubscription(theMsg.getId(myFhirContext)); break; case CREATE: case UPDATE: activateAndRegisterSubscriptionIfRequiredInTransaction(theMsg.getNewPayload(myFhirContext)); break; default: break; } }
public synchronized boolean registerSubscriptionUnlessAlreadyRegistered(IBaseResource theSubscription) { Optional<CanonicalSubscription> existingSubscription = hasSubscription(theSubscription.getIdElement()); CanonicalSubscription newSubscription = mySubscriptionCanonicalizer.canonicalize(theSubscription); if (existingSubscription.isPresent()) { if (newSubscription.equals(existingSubscription.get())) { // No changes return false; } ourLog.info("Updating already-registered active subscription {}", theSubscription.getIdElement().toUnqualified().getValue()); unregisterSubscription(theSubscription.getIdElement()); } else { ourLog.info("Registering active subscription {}", theSubscription.getIdElement().toUnqualified().getValue()); } if (Subscription.SubscriptionStatus.ACTIVE.equals(newSubscription.getStatus())) { registerSubscription(theSubscription.getIdElement(), theSubscription); return true; } else { return false; } }
private void submitResourceModified(final ResourceModifiedMessage theMsg) { switch (theMsg.getOperationType()) { case DELETE: mySubscriptionRegistry.unregisterSubscription(theMsg.getId(myFhirContext)); break; case CREATE: case UPDATE: activateAndRegisterSubscriptionIfRequiredInTransaction(theMsg.getNewPayload(myFhirContext)); break; default: break; } }