Rename $retrigger-subscription to $trigger-subscription based on
Diederik's suggestion
This commit is contained in:
parent
34bb70af65
commit
8bd185acf2
|
@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.config;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.i18n.HapiLocalizer;
|
import ca.uhn.fhir.i18n.HapiLocalizer;
|
||||||
import ca.uhn.fhir.jpa.dao.DaoRegistry;
|
import ca.uhn.fhir.jpa.dao.DaoRegistry;
|
||||||
import ca.uhn.fhir.jpa.provider.SubscriptionRetriggeringProvider;
|
import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider;
|
||||||
import ca.uhn.fhir.jpa.search.*;
|
import ca.uhn.fhir.jpa.search.*;
|
||||||
import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc;
|
import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc;
|
||||||
import ca.uhn.fhir.jpa.sp.SearchParamPresenceSvcImpl;
|
import ca.uhn.fhir.jpa.sp.SearchParamPresenceSvcImpl;
|
||||||
|
@ -117,8 +117,8 @@ public abstract class BaseConfig implements SchedulingConfigurer {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Lazy
|
@Lazy
|
||||||
public SubscriptionRetriggeringProvider mySubscriptionRetriggeringProvider() {
|
public SubscriptionTriggeringProvider mySubscriptionTriggeringProvider() {
|
||||||
return new SubscriptionRetriggeringProvider();
|
return new SubscriptionTriggeringProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(autowire = Autowire.BY_TYPE)
|
@Bean(autowire = Autowire.BY_TYPE)
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SubscriptionRetriggeringProvider implements IResourceProvider {
|
public class SubscriptionTriggeringProvider implements IResourceProvider {
|
||||||
|
|
||||||
public static final String RESOURCE_ID = "resourceId";
|
public static final String RESOURCE_ID = "resourceId";
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -52,8 +52,8 @@ public class SubscriptionRetriggeringProvider implements IResourceProvider {
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private List<BaseSubscriptionInterceptor<?>> mySubscriptionInterceptorList;
|
private List<BaseSubscriptionInterceptor<?>> mySubscriptionInterceptorList;
|
||||||
|
|
||||||
@Operation(name= JpaConstants.OPERATION_RETRIGGER_SUBSCRIPTION)
|
@Operation(name= JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
|
||||||
public IBaseParameters reTriggerSubscription(
|
public IBaseParameters triggerSubscription(
|
||||||
@IdParam IIdType theSubscriptionId,
|
@IdParam IIdType theSubscriptionId,
|
||||||
@OperationParam(name= RESOURCE_ID) UriParam theResourceId) {
|
@OperationParam(name= RESOURCE_ID) UriParam theResourceId) {
|
||||||
|
|
||||||
|
@ -64,13 +64,13 @@ public class SubscriptionRetriggeringProvider implements IResourceProvider {
|
||||||
|
|
||||||
Class<? extends IBaseResource> resourceType = myFhirContext.getResourceDefinition(resourceId.getResourceType()).getImplementingClass();
|
Class<? extends IBaseResource> resourceType = myFhirContext.getResourceDefinition(resourceId.getResourceType()).getImplementingClass();
|
||||||
IFhirResourceDao<? extends IBaseResource> dao = mySystemDao.getDao(resourceType);
|
IFhirResourceDao<? extends IBaseResource> dao = mySystemDao.getDao(resourceType);
|
||||||
IBaseResource resourceToRetrigger = dao.read(resourceId);
|
IBaseResource resourceToTrigger = dao.read(resourceId);
|
||||||
|
|
||||||
ResourceModifiedMessage msg = new ResourceModifiedMessage();
|
ResourceModifiedMessage msg = new ResourceModifiedMessage();
|
||||||
msg.setId(resourceToRetrigger.getIdElement());
|
msg.setId(resourceToTrigger.getIdElement());
|
||||||
msg.setOperationType(ResourceModifiedMessage.OperationTypeEnum.UPDATE);
|
msg.setOperationType(ResourceModifiedMessage.OperationTypeEnum.UPDATE);
|
||||||
msg.setSubscriptionId(theSubscriptionId.toUnqualifiedVersionless().getValue());
|
msg.setSubscriptionId(theSubscriptionId.toUnqualifiedVersionless().getValue());
|
||||||
msg.setNewPayload(myFhirContext, resourceToRetrigger);
|
msg.setNewPayload(myFhirContext, resourceToTrigger);
|
||||||
|
|
||||||
for (BaseSubscriptionInterceptor<?> next :mySubscriptionInterceptorList) {
|
for (BaseSubscriptionInterceptor<?> next :mySubscriptionInterceptorList) {
|
||||||
next.submitResourceModified(msg);
|
next.submitResourceModified(msg);
|
|
@ -39,7 +39,7 @@ public class ResourceModifiedMessage {
|
||||||
@JsonProperty("operationType")
|
@JsonProperty("operationType")
|
||||||
private OperationTypeEnum myOperationType;
|
private OperationTypeEnum myOperationType;
|
||||||
/**
|
/**
|
||||||
* This will only be set if the resource is being retriggered for a specific
|
* This will only be set if the resource is being triggered for a specific
|
||||||
* subscription
|
* subscription
|
||||||
*/
|
*/
|
||||||
@JsonProperty(value = "subscriptionId", required = false)
|
@JsonProperty(value = "subscriptionId", required = false)
|
||||||
|
@ -97,7 +97,7 @@ public class ResourceModifiedMessage {
|
||||||
CREATE,
|
CREATE,
|
||||||
UPDATE,
|
UPDATE,
|
||||||
DELETE,
|
DELETE,
|
||||||
MANUALLY_RETRIGGERED;
|
MANUALLY_TRIGGERED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class SubscriptionCheckingSubscriber extends BaseSubscriptionSubscriber {
|
||||||
switch (msg.getOperationType()) {
|
switch (msg.getOperationType()) {
|
||||||
case CREATE:
|
case CREATE:
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
case MANUALLY_RETRIGGERED:
|
case MANUALLY_TRIGGERED:
|
||||||
break;
|
break;
|
||||||
case DELETE:
|
case DELETE:
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class JpaConstants {
|
||||||
public static final String OPERATION_DOCUMENT = "$document";
|
public static final String OPERATION_DOCUMENT = "$document";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrigger a subscription manually for a given resource
|
* Trigger a subscription manually for a given resource
|
||||||
*/
|
*/
|
||||||
public static final String OPERATION_RETRIGGER_SUBSCRIPTION = "$retrigger-subscription";
|
public static final String OPERATION_TRIGGER_SUBSCRIPTION = "$trigger-subscription";
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import ca.uhn.fhir.jpa.config.WebsocketDispatcherConfig;
|
||||||
import ca.uhn.fhir.jpa.dao.data.ISearchDao;
|
import ca.uhn.fhir.jpa.dao.data.ISearchDao;
|
||||||
import ca.uhn.fhir.jpa.dao.dstu3.BaseJpaDstu3Test;
|
import ca.uhn.fhir.jpa.dao.dstu3.BaseJpaDstu3Test;
|
||||||
import ca.uhn.fhir.jpa.dao.dstu3.SearchParamRegistryDstu3;
|
import ca.uhn.fhir.jpa.dao.dstu3.SearchParamRegistryDstu3;
|
||||||
import ca.uhn.fhir.jpa.provider.SubscriptionRetriggeringProvider;
|
import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider;
|
||||||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||||
import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc;
|
import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc;
|
||||||
import ca.uhn.fhir.jpa.subscription.email.SubscriptionEmailInterceptor;
|
import ca.uhn.fhir.jpa.subscription.email.SubscriptionEmailInterceptor;
|
||||||
|
@ -100,8 +100,8 @@ public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test {
|
||||||
myTerminologyUploaderProvider = myAppCtx.getBean(TerminologyUploaderProviderDstu3.class);
|
myTerminologyUploaderProvider = myAppCtx.getBean(TerminologyUploaderProviderDstu3.class);
|
||||||
ourRestServer.setPlainProviders(mySystemProvider, myTerminologyUploaderProvider);
|
ourRestServer.setPlainProviders(mySystemProvider, myTerminologyUploaderProvider);
|
||||||
|
|
||||||
SubscriptionRetriggeringProvider subscriptionRetriggeringProvider = myAppCtx.getBean(SubscriptionRetriggeringProvider.class);
|
SubscriptionTriggeringProvider subscriptionTriggeringProvider = myAppCtx.getBean(SubscriptionTriggeringProvider.class);
|
||||||
ourRestServer.registerProvider(subscriptionRetriggeringProvider);
|
ourRestServer.registerProvider(subscriptionTriggeringProvider);
|
||||||
|
|
||||||
JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(ourRestServer, mySystemDao, myDaoConfig);
|
JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(ourRestServer, mySystemDao, myDaoConfig);
|
||||||
confProvider.setImplementationDescription("THIS IS THE DESC");
|
confProvider.setImplementationDescription("THIS IS THE DESC");
|
||||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.subscription;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.provider.SubscriptionRetriggeringProvider;
|
import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider;
|
||||||
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
||||||
import ca.uhn.fhir.jpa.util.JpaConstants;
|
import ca.uhn.fhir.jpa.util.JpaConstants;
|
||||||
import ca.uhn.fhir.rest.annotation.Create;
|
import ca.uhn.fhir.rest.annotation.Create;
|
||||||
|
@ -33,9 +33,9 @@ import static org.junit.Assert.assertEquals;
|
||||||
* Test the rest-hook subscriptions
|
* Test the rest-hook subscriptions
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
public class RetriggeringDstu3Test extends BaseResourceProviderDstu3Test {
|
public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RetriggeringDstu3Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SubscriptionTriggeringDstu3Test.class);
|
||||||
private static List<Observation> ourCreatedObservations = Lists.newArrayList();
|
private static List<Observation> ourCreatedObservations = Lists.newArrayList();
|
||||||
private static int ourListenerPort;
|
private static int ourListenerPort;
|
||||||
private static RestfulServer ourListenerRestServer;
|
private static RestfulServer ourListenerRestServer;
|
||||||
|
@ -117,7 +117,7 @@ public class RetriggeringDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRetriggerResourceToSpecificSubscription() throws Exception {
|
public void testTriggerResourceToSpecificSubscription() throws Exception {
|
||||||
String payload = "application/fhir+json";
|
String payload = "application/fhir+json";
|
||||||
|
|
||||||
String code = "1000000050";
|
String code = "1000000050";
|
||||||
|
@ -140,8 +140,8 @@ public class RetriggeringDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
Parameters response = ourClient
|
Parameters response = ourClient
|
||||||
.operation()
|
.operation()
|
||||||
.onInstance(subscriptionId)
|
.onInstance(subscriptionId)
|
||||||
.named(JpaConstants.OPERATION_RETRIGGER_SUBSCRIPTION)
|
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
|
||||||
.withParameter(Parameters.class, SubscriptionRetriggeringProvider.RESOURCE_ID, new UriType(obsId.toUnqualifiedVersionless().getValue()))
|
.withParameter(Parameters.class, SubscriptionTriggeringProvider.RESOURCE_ID, new UriType(obsId.toUnqualifiedVersionless().getValue()))
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
||||||
|
@ -154,7 +154,7 @@ public class RetriggeringDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRetriggerResourceToSpecificSubscriptionWhichDoesntMatch() throws Exception {
|
public void testTriggerResourceToSpecificSubscriptionWhichDoesntMatch() throws Exception {
|
||||||
String payload = "application/fhir+json";
|
String payload = "application/fhir+json";
|
||||||
|
|
||||||
String code = "1000000050";
|
String code = "1000000050";
|
||||||
|
@ -177,8 +177,8 @@ public class RetriggeringDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
Parameters response = ourClient
|
Parameters response = ourClient
|
||||||
.operation()
|
.operation()
|
||||||
.onInstance(subscriptionId)
|
.onInstance(subscriptionId)
|
||||||
.named(JpaConstants.OPERATION_RETRIGGER_SUBSCRIPTION)
|
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
|
||||||
.withParameter(Parameters.class, SubscriptionRetriggeringProvider.RESOURCE_ID, new UriType(obsId.toUnqualifiedVersionless().getValue()))
|
.withParameter(Parameters.class, SubscriptionTriggeringProvider.RESOURCE_ID, new UriType(obsId.toUnqualifiedVersionless().getValue()))
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
|
@ -34,7 +34,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action type="add">
|
<action type="add">
|
||||||
A new operation has been added to the JPA server called
|
A new operation has been added to the JPA server called
|
||||||
<![CDATA[<code>$retrigger-subscription</code>]]>. This can
|
<![CDATA[<code>$trigger-subscription</code>]]>. This can
|
||||||
be used to cause a transaction to redeliver a resource that previously triggered.
|
be used to cause a transaction to redeliver a resource that previously triggered.
|
||||||
</action>
|
</action>
|
||||||
<action type="add">
|
<action type="add">
|
||||||
|
|
Loading…
Reference in New Issue