Move process-message to the correct level
This commit is contained in:
parent
a2d4c93922
commit
f8b8f2d1b0
|
@ -27,11 +27,6 @@ import org.hl7.fhir.instance.model.api.IBaseBundle;
|
|||
|
||||
public class FhirResourceDaoMessageHeaderDstu2 extends FhirResourceDaoDstu2<MessageHeader> implements IFhirResourceDaoMessageHeader<MessageHeader> {
|
||||
|
||||
@Override
|
||||
public IBaseBundle messageHeaderProcessMessage(RequestDetails theRequestDetails, IBaseBundle theMessage) {
|
||||
return FhirResourceDaoMessageHeaderDstu2.throwProcessMessageNotImplemented();
|
||||
}
|
||||
|
||||
public static IBaseBundle throwProcessMessageNotImplemented() {
|
||||
throw new NotImplementedOperationException("This operation is not yet implemented on this server");
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ import ca.uhn.fhir.util.UrlUtil;
|
|||
import ca.uhn.fhir.util.UrlUtil.UrlParts;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -665,7 +666,11 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle, MetaDt> {
|
|||
return Integer.toString(theStatusCode) + " " + defaultString(Constants.HTTP_STATUS_NAMES.get(theStatusCode));
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
@Override
|
||||
public IBaseBundle processMessage(RequestDetails theRequestDetails, IBaseBundle theMessage) {
|
||||
return FhirResourceDaoMessageHeaderDstu2.throwProcessMessageNotImplemented();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Transaction Order, per the spec:
|
||||
|
@ -675,7 +680,6 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle, MetaDt> {
|
|||
* Process any PUT interactions
|
||||
* Process any GET interactions
|
||||
*/
|
||||
//@formatter:off
|
||||
public class TransactionSorter implements Comparator<Entry> {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ca.uhn.fhir.jpa.dao;
|
||||
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
/*
|
||||
|
@ -25,7 +23,5 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
|
|||
*/
|
||||
|
||||
public interface IFhirResourceDaoMessageHeader<T extends IBaseResource> extends IFhirResourceDao<T> {
|
||||
|
||||
IBaseBundle messageHeaderProcessMessage(RequestDetails theRequestDetails, IBaseBundle theMessage);
|
||||
|
||||
// nothing right now
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.util.ExpungeOptions;
|
|||
import ca.uhn.fhir.jpa.util.ExpungeOutcome;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -60,6 +61,12 @@ public interface IFhirSystemDao<T, MT> extends IDao {
|
|||
*/
|
||||
MT metaGetOperation(RequestDetails theRequestDetails);
|
||||
|
||||
/**
|
||||
* Implementations may implement this method to implement the $process-message
|
||||
* operation
|
||||
*/
|
||||
IBaseBundle processMessage(RequestDetails theRequestDetails, IBaseBundle theMessage);
|
||||
|
||||
T transaction(RequestDetails theRequestDetails, T theResources);
|
||||
|
||||
}
|
||||
|
|
|
@ -20,17 +20,9 @@ package ca.uhn.fhir.jpa.dao.dstu3;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.FhirResourceDaoMessageHeaderDstu2;
|
||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoMessageHeader;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import org.hl7.fhir.dstu3.model.MessageHeader;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
|
||||
public class FhirResourceDaoMessageHeaderDstu3 extends FhirResourceDaoDstu3<MessageHeader> implements IFhirResourceDaoMessageHeader<MessageHeader> {
|
||||
|
||||
@Override
|
||||
public IBaseBundle messageHeaderProcessMessage(RequestDetails theRequestDetails, IBaseBundle theMessage) {
|
||||
return FhirResourceDaoMessageHeaderDstu2.throwProcessMessageNotImplemented();
|
||||
}
|
||||
|
||||
// nothing right now
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirSystemDao;
|
||||
import ca.uhn.fhir.jpa.dao.FhirResourceDaoMessageHeaderDstu2;
|
||||
import ca.uhn.fhir.jpa.dao.TransactionProcessor;
|
||||
import ca.uhn.fhir.jpa.model.entity.TagDefinition;
|
||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||
|
@ -29,6 +30,7 @@ import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetai
|
|||
import org.hl7.fhir.dstu3.model.Bundle;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.dstu3.model.Meta;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -79,6 +81,11 @@ public class FhirSystemDaoDstu3 extends BaseHapiFhirSystemDao<Bundle, Meta> {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBaseBundle processMessage(RequestDetails theRequestDetails, IBaseBundle theMessage) {
|
||||
return FhirResourceDaoMessageHeaderDstu2.throwProcessMessageNotImplemented();
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.NEVER)
|
||||
@Override
|
||||
public Bundle transaction(RequestDetails theRequestDetails, Bundle theRequest) {
|
||||
|
@ -86,4 +93,5 @@ public class FhirSystemDaoDstu3 extends BaseHapiFhirSystemDao<Bundle, Meta> {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,17 +20,9 @@ package ca.uhn.fhir.jpa.dao.r4;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.FhirResourceDaoMessageHeaderDstu2;
|
||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoMessageHeader;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.r4.model.MessageHeader;
|
||||
|
||||
public class FhirResourceDaoMessageHeaderR4 extends FhirResourceDaoR4<MessageHeader> implements IFhirResourceDaoMessageHeader<MessageHeader> {
|
||||
|
||||
@Override
|
||||
public IBaseBundle messageHeaderProcessMessage(RequestDetails theRequestDetails, IBaseBundle theMessage) {
|
||||
return FhirResourceDaoMessageHeaderDstu2.throwProcessMessageNotImplemented();
|
||||
}
|
||||
|
||||
// nothing right now
|
||||
}
|
||||
|
|
|
@ -21,11 +21,13 @@ package ca.uhn.fhir.jpa.dao.r4;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirSystemDao;
|
||||
import ca.uhn.fhir.jpa.dao.FhirResourceDaoMessageHeaderDstu2;
|
||||
import ca.uhn.fhir.jpa.dao.TransactionProcessor;
|
||||
import ca.uhn.fhir.jpa.model.entity.TagDefinition;
|
||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.r4.model.Meta;
|
||||
|
@ -64,6 +66,11 @@ public class FhirSystemDaoR4 extends BaseHapiFhirSystemDao<Bundle, Meta> {
|
|||
return toMeta(tagDefinitions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBaseBundle processMessage(RequestDetails theRequestDetails, IBaseBundle theMessage) {
|
||||
return FhirResourceDaoMessageHeaderDstu2.throwProcessMessageNotImplemented();
|
||||
}
|
||||
|
||||
|
||||
protected Meta toMeta(Collection<TagDefinition> tagDefinitions) {
|
||||
Meta retVal = new Meta();
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.provider;
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoMessageHeader;
|
||||
import ca.uhn.fhir.jpa.util.JpaConstants;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.dstu2.resource.MessageHeader;
|
||||
import ca.uhn.fhir.rest.annotation.Operation;
|
||||
import ca.uhn.fhir.rest.annotation.OperationParam;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
|
@ -33,29 +23,5 @@ import javax.servlet.http.HttpServletRequest;
|
|||
*/
|
||||
|
||||
public class BaseJpaResourceProviderMessageHeaderDstu2 extends JpaResourceProviderDstu2<MessageHeader> {
|
||||
|
||||
|
||||
/**
|
||||
* /MessageHeader/$process-message
|
||||
*/
|
||||
@Operation(name = JpaConstants.OPERATION_PROCESS_MESSAGE, idempotent = false)
|
||||
public IBaseBundle processMessage(
|
||||
HttpServletRequest theServletRequest,
|
||||
RequestDetails theRequestDetails,
|
||||
|
||||
@OperationParam(name = "content", min = 1, max = 1)
|
||||
@Description(formalDefinition = "The message to process (or, if using asynchronous messaging, it may be a response message to accept)")
|
||||
Bundle theMessageToProcess
|
||||
) {
|
||||
|
||||
startRequest(theServletRequest);
|
||||
try {
|
||||
return ((IFhirResourceDaoMessageHeader<MessageHeader>) getDao()).messageHeaderProcessMessage(theRequestDetails, theMessageToProcess);
|
||||
} finally {
|
||||
endRequest(theServletRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// nothing now
|
||||
}
|
||||
|
|
|
@ -18,11 +18,13 @@ import ca.uhn.fhir.rest.annotation.*;
|
|||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r4.model.IntegerType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -248,6 +250,28 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* /$process-message
|
||||
*/
|
||||
@Operation(name = JpaConstants.OPERATION_PROCESS_MESSAGE, idempotent = false)
|
||||
public IBaseBundle processMessage(
|
||||
HttpServletRequest theServletRequest,
|
||||
RequestDetails theRequestDetails,
|
||||
|
||||
@OperationParam(name = "content", min = 1, max = 1)
|
||||
@Description(formalDefinition = "The message to process (or, if using asynchronous messaging, it may be a response message to accept)")
|
||||
Bundle theMessageToProcess
|
||||
) {
|
||||
|
||||
startRequest(theServletRequest);
|
||||
try {
|
||||
return getDao().processMessage(theRequestDetails, theMessageToProcess);
|
||||
} finally {
|
||||
endRequest(theServletRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Parameters toExpungeResponse(org.hl7.fhir.r4.model.Parameters theRetVal) {
|
||||
Integer count = ((IntegerType) theRetVal.getParameterFirstRep().getValue()).getValue();
|
||||
return new Parameters()
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.provider.dstu3;
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoMessageHeader;
|
||||
import ca.uhn.fhir.jpa.util.JpaConstants;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.rest.annotation.Operation;
|
||||
import ca.uhn.fhir.rest.annotation.OperationParam;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import org.hl7.fhir.dstu3.model.Bundle;
|
||||
import org.hl7.fhir.dstu3.model.MessageHeader;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
|
@ -33,29 +23,5 @@ import javax.servlet.http.HttpServletRequest;
|
|||
*/
|
||||
|
||||
public class BaseJpaResourceProviderMessageHeaderDstu3 extends JpaResourceProviderDstu3<MessageHeader> {
|
||||
|
||||
|
||||
/**
|
||||
* /MessageHeader/$process-message
|
||||
*/
|
||||
@Operation(name = JpaConstants.OPERATION_PROCESS_MESSAGE, idempotent = false)
|
||||
public IBaseBundle processMessage(
|
||||
HttpServletRequest theServletRequest,
|
||||
RequestDetails theRequestDetails,
|
||||
|
||||
@OperationParam(name = "content", min = 1, max = 1)
|
||||
@Description(formalDefinition = "The message to process (or, if using asynchronous messaging, it may be a response message to accept)")
|
||||
Bundle theMessageToProcess
|
||||
) {
|
||||
|
||||
startRequest(theServletRequest);
|
||||
try {
|
||||
return ((IFhirResourceDaoMessageHeader<MessageHeader>) getDao()).messageHeaderProcessMessage(theRequestDetails, theMessageToProcess);
|
||||
} finally {
|
||||
endRequest(theServletRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// nothing now
|
||||
}
|
||||
|
|
|
@ -15,10 +15,12 @@ import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
|||
import org.hl7.fhir.dstu3.model.*;
|
||||
import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -250,6 +252,28 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* /$process-message
|
||||
*/
|
||||
@Operation(name = JpaConstants.OPERATION_PROCESS_MESSAGE, idempotent = false)
|
||||
public IBaseBundle processMessage(
|
||||
HttpServletRequest theServletRequest,
|
||||
RequestDetails theRequestDetails,
|
||||
|
||||
@OperationParam(name = "content", min = 1, max = 1)
|
||||
@Description(formalDefinition = "The message to process (or, if using asynchronous messaging, it may be a response message to accept)")
|
||||
Bundle theMessageToProcess
|
||||
) {
|
||||
|
||||
startRequest(theServletRequest);
|
||||
try {
|
||||
return getDao().processMessage(theRequestDetails, theMessageToProcess);
|
||||
} finally {
|
||||
endRequest(theServletRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void validateFulltextSearchEnabled(IFulltextSearchSvc theSearchDao) {
|
||||
if (theSearchDao == null || theSearchDao.isDisabled()) {
|
||||
throw new InvalidRequestException("Fulltext searching is disabled on this server");
|
||||
|
|
|
@ -33,29 +33,5 @@ import javax.servlet.http.HttpServletRequest;
|
|||
*/
|
||||
|
||||
public class BaseJpaResourceProviderMessageHeaderR4 extends JpaResourceProviderR4<MessageHeader> {
|
||||
|
||||
|
||||
/**
|
||||
* /MessageHeader/$process-message
|
||||
*/
|
||||
@Operation(name = JpaConstants.OPERATION_PROCESS_MESSAGE, idempotent = false)
|
||||
public IBaseBundle processMessage(
|
||||
HttpServletRequest theServletRequest,
|
||||
RequestDetails theRequestDetails,
|
||||
|
||||
@OperationParam(name = "content", min = 1, max = 1)
|
||||
@Description(formalDefinition = "The message to process (or, if using asynchronous messaging, it may be a response message to accept)")
|
||||
Bundle theMessageToProcess
|
||||
) {
|
||||
|
||||
startRequest(theServletRequest);
|
||||
try {
|
||||
return ((IFhirResourceDaoMessageHeader<MessageHeader>) getDao()).messageHeaderProcessMessage(theRequestDetails, theMessageToProcess);
|
||||
} finally {
|
||||
endRequest(theServletRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// nothing right now
|
||||
}
|
||||
|
|
|
@ -10,12 +10,14 @@ import ca.uhn.fhir.rest.annotation.*;
|
|||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r4.model.*;
|
||||
import org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -229,6 +231,28 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
|
|||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* /$process-message
|
||||
*/
|
||||
@Operation(name = JpaConstants.OPERATION_PROCESS_MESSAGE, idempotent = false)
|
||||
public IBaseBundle processMessage(
|
||||
HttpServletRequest theServletRequest,
|
||||
RequestDetails theRequestDetails,
|
||||
|
||||
@OperationParam(name = "content", min = 1, max = 1)
|
||||
@Description(formalDefinition = "The message to process (or, if using asynchronous messaging, it may be a response message to accept)")
|
||||
Bundle theMessageToProcess
|
||||
) {
|
||||
|
||||
startRequest(theServletRequest);
|
||||
try {
|
||||
return getDao().processMessage(theRequestDetails, theMessageToProcess);
|
||||
} finally {
|
||||
endRequest(theServletRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Transaction
|
||||
public Bundle transaction(RequestDetails theRequestDetails, @TransactionParam Bundle theResources) {
|
||||
startRequest(((ServletRequestDetails) theRequestDetails).getServletRequest());
|
||||
|
|
|
@ -1693,7 +1693,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
|
|||
.setName("content")
|
||||
.setResource(bundle);
|
||||
try {
|
||||
ourClient.operation().onType(MessageHeader.class).named(JpaConstants.OPERATION_PROCESS_MESSAGE).withParameters(parameters).execute();
|
||||
ourClient.operation().onServer().named(JpaConstants.OPERATION_PROCESS_MESSAGE).withParameters(parameters).execute();
|
||||
fail();
|
||||
} catch (NotImplementedOperationException e) {
|
||||
assertThat(e.getMessage(), containsString("This operation is not yet implemented on this server"));
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ResourceProviderR4BundleTest extends BaseResourceProviderR4Test {
|
|||
.setName("content")
|
||||
.setResource(bundle);
|
||||
try {
|
||||
ourClient.operation().onType(MessageHeader.class).named(JpaConstants.OPERATION_PROCESS_MESSAGE).withParameters(parameters).execute();
|
||||
ourClient.operation().onServer().named(JpaConstants.OPERATION_PROCESS_MESSAGE).withParameters(parameters).execute();
|
||||
fail();
|
||||
} catch (NotImplementedOperationException e) {
|
||||
assertThat(e.getMessage(), containsString("This operation is not yet implemented on this server"));
|
||||
|
|
|
@ -1728,7 +1728,7 @@ public class AuthorizationInterceptorDstu3Test {
|
|||
@Override
|
||||
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
|
||||
return new RuleBuilder()
|
||||
.allow("RULE 1").operation().named("process-message").onType(MessageHeader.class).andRequireExplicitResponseAuthorization().andThen()
|
||||
.allow("RULE 1").operation().named("process-message").onServer().andRequireExplicitResponseAuthorization().andThen()
|
||||
.build();
|
||||
}
|
||||
});
|
||||
|
@ -1743,7 +1743,7 @@ public class AuthorizationInterceptorDstu3Test {
|
|||
|
||||
// With body
|
||||
ourHitMethod = false;
|
||||
httpPost = new HttpPost("http://localhost:" + ourPort + "/MessageHeader/$process-message");
|
||||
httpPost = new HttpPost("http://localhost:" + ourPort + "/$process-message");
|
||||
httpPost.setEntity(new StringEntity(inputString, ContentType.create(Constants.CT_FHIR_JSON_NEW, Charsets.UTF_8)));
|
||||
status = ourClient.execute(httpPost);
|
||||
response = extractResponseAndClose(status);
|
||||
|
@ -1753,7 +1753,7 @@ public class AuthorizationInterceptorDstu3Test {
|
|||
|
||||
// With body
|
||||
ourHitMethod = false;
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/MessageHeader/$process-message");
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/$process-message");
|
||||
status = ourClient.execute(httpGet);
|
||||
response = extractResponseAndClose(status);
|
||||
ourLog.info(response);
|
||||
|
@ -3348,21 +3348,6 @@ public class AuthorizationInterceptorDstu3Test {
|
|||
|
||||
}
|
||||
|
||||
public static class DummyMessageHeaderResourceProvider implements IResourceProvider {
|
||||
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return MessageHeader.class;
|
||||
}
|
||||
|
||||
@Operation(name = "process-message", idempotent = true)
|
||||
public Parameters operation0(@OperationParam(name = "content") Bundle theInput) {
|
||||
ourHitMethod = true;
|
||||
return (Parameters) new Parameters().setId("1");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class DummyDiagnosticReportResourceProvider implements IResourceProvider {
|
||||
|
||||
|
@ -3633,6 +3618,13 @@ public class AuthorizationInterceptorDstu3Test {
|
|||
return (Parameters) new Parameters().setId("1");
|
||||
}
|
||||
|
||||
@Operation(name = "process-message", idempotent = true)
|
||||
public Parameters processMessage(@OperationParam(name = "content") Bundle theInput) {
|
||||
ourHitMethod = true;
|
||||
return (Parameters) new Parameters().setId("1");
|
||||
}
|
||||
|
||||
|
||||
@Transaction()
|
||||
public Bundle search(IRequestOperationCallback theRequestOperationCallback, @TransactionParam Bundle theInput) {
|
||||
ourHitMethod = true;
|
||||
|
@ -3664,13 +3656,12 @@ public class AuthorizationInterceptorDstu3Test {
|
|||
DummyEncounterResourceProvider encProv = new DummyEncounterResourceProvider();
|
||||
DummyCarePlanResourceProvider cpProv = new DummyCarePlanResourceProvider();
|
||||
DummyDiagnosticReportResourceProvider drProv = new DummyDiagnosticReportResourceProvider();
|
||||
DummyMessageHeaderResourceProvider mshProv = new DummyMessageHeaderResourceProvider();
|
||||
PlainProvider plainProvider = new PlainProvider();
|
||||
|
||||
ServletHandler proxyHandler = new ServletHandler();
|
||||
ourServlet = new RestfulServer(ourCtx);
|
||||
ourServlet.setFhirContext(ourCtx);
|
||||
ourServlet.setResourceProviders(patProvider, obsProv, encProv, cpProv, orgProv, drProv, mshProv);
|
||||
ourServlet.setResourceProviders(patProvider, obsProv, encProv, cpProv, orgProv, drProv);
|
||||
ourServlet.setPlainProviders(plainProvider);
|
||||
ourServlet.setPagingProvider(new FifoMemoryPagingProvider(100));
|
||||
ourServlet.setDefaultResponseEncoding(EncodingEnum.JSON);
|
||||
|
|
Loading…
Reference in New Issue