Operations which are not resource type specific were not showing up in REST server's conformance
This commit is contained in:
parent
a35d20b999
commit
61cb60b293
|
@ -403,10 +403,6 @@
|
|||
<packageBase>ca.uhn.fhir.jpa.rp.dstu</packageBase>
|
||||
<targetResourceSpringBeansFile>hapi-fhir-server-resourceproviders-dstu1.xml</targetResourceSpringBeansFile>
|
||||
<baseResourceNames></baseResourceNames>
|
||||
<excludeResourceNames>
|
||||
<excludeResourceName>Conformance</excludeResourceName>
|
||||
<excludeResourceName>OperationDefinition</excludeResourceName>
|
||||
</excludeResourceNames>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
|
@ -419,6 +415,11 @@
|
|||
<packageBase>ca.uhn.fhir.jpa.rp.dstu2</packageBase>
|
||||
<targetResourceSpringBeansFile>hapi-fhir-server-resourceproviders-dstu2.xml</targetResourceSpringBeansFile>
|
||||
<baseResourceNames></baseResourceNames>
|
||||
<excludeResourceNames>
|
||||
<excludeResourceName>Conformance</excludeResourceName>
|
||||
<excludeResourceName>OperationDefinition</excludeResourceName>
|
||||
<excludeResourceName>OperationOutcome</excludeResourceName>
|
||||
</excludeResourceNames>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package ca.uhn.fhir.jpa.testutil;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SpringFileTest {
|
||||
|
||||
@Test
|
||||
public void testNoBadResources() throws Exception {
|
||||
String text = IOUtils.toString(SpringFileTest.class.getResourceAsStream("/hapi-fhir-server-resourceproviders-dstu2.xml"));
|
||||
assertThat(text, not(containsString("OperationDefinition")));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +1,10 @@
|
|||
package ca.uhn.fhirtest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
@ -19,7 +17,6 @@ import ca.uhn.fhir.rest.api.MethodOutcome;
|
|||
import ca.uhn.fhir.rest.client.IGenericClient;
|
||||
|
||||
public class UhnFhirTestApp {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(UhnFhirTestApp.class);
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
|
|
|
@ -36,12 +36,6 @@
|
|||
<artifactId>junit</artifactId>
|
||||
<version>${junit_version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xmlunit</groupId>
|
||||
|
|
|
@ -290,6 +290,11 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
} else {
|
||||
for (BaseMethodBinding<?> nextMethodBinding : nextEntry.getValue()) {
|
||||
checkBindingForSystemOps(rest, systemOps, nextMethodBinding);
|
||||
if (nextMethodBinding instanceof OperationMethodBinding) {
|
||||
OperationMethodBinding methodBinding = (OperationMethodBinding) nextMethodBinding;
|
||||
String opName = myOperationBindingToName.get(methodBinding);
|
||||
rest.addOperation().setName(methodBinding.getName()).getDefinition().setReference("OperationDefinition/" + opName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,29 @@ public class ServerConformanceProviderDstu2Test {
|
|||
return sc;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
RestResource res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertTrue(res.getConditionalCreate());
|
||||
assertTrue(res.getConditionalDelete());
|
||||
assertTrue(res.getConditionalUpdate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtendedOperationReturningBundle() throws Exception {
|
||||
|
||||
|
@ -98,13 +121,14 @@ public class ServerConformanceProviderDstu2Test {
|
|||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ProviderWithExtendedOperationReturningBundle());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs) {
|
||||
};
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
OperationDefinition opDef = sc.readOperationDefinition(new IdDt("OperationDefinition/everything"));
|
||||
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef);
|
||||
ourLog.info(conf);
|
||||
|
||||
|
@ -164,6 +188,29 @@ public class ServerConformanceProviderDstu2Test {
|
|||
assertThat(conf, containsString("<type value=\"token\"/>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new NonConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
RestResource res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertNull(res.getConditionalCreate());
|
||||
assertNull(res.getConditionalDelete());
|
||||
assertNull(res.getConditionalUpdate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperationDocumentation() throws Exception {
|
||||
|
||||
|
@ -197,6 +244,33 @@ public class ServerConformanceProviderDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperationOnNoTypes() throws Exception {
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new PlainProviderWithExtendedOperationOnNoType());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs) {
|
||||
@Override
|
||||
public Conformance getServerConformance(HttpServletRequest theRequest) {
|
||||
return super.getServerConformance(theRequest);
|
||||
}
|
||||
};
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance sconf = sc.getServerConformance(createHttpServletRequest());
|
||||
assertEquals("OperationDefinition/plain", sconf.getRest().get(0).getOperation().get(0).getDefinition().getReference().getValue());
|
||||
|
||||
OperationDefinition opDef = sc.readOperationDefinition(new IdDt("OperationDefinition/plain"));
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef);
|
||||
ourLog.info(conf);
|
||||
|
||||
assertEquals("$plain", opDef.getCode());
|
||||
assertEquals(true, opDef.getIdempotent().booleanValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProviderWithRequiredAndOptional() throws Exception {
|
||||
|
||||
|
@ -267,52 +341,6 @@ public class ServerConformanceProviderDstu2Test {
|
|||
assertThat(conf, containsString("<interaction><code value=\"read\"/></interaction>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
RestResource res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertTrue(res.getConditionalCreate());
|
||||
assertTrue(res.getConditionalDelete());
|
||||
assertTrue(res.getConditionalUpdate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new NonConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
RestResource res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertNull(res.getConditionalCreate());
|
||||
assertNull(res.getConditionalDelete());
|
||||
assertNull(res.getConditionalUpdate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchParameterDocumentation() throws Exception {
|
||||
|
||||
|
@ -400,6 +428,30 @@ public class ServerConformanceProviderDstu2Test {
|
|||
assertTrue(ourCtx.newValidator().validateWithResult(conformance).isSuccessful());
|
||||
}
|
||||
|
||||
public static class ConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdDt theId, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdDt theId, @ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class InstanceHistoryProvider implements IResourceProvider {
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
|
@ -425,6 +477,39 @@ public class ServerConformanceProviderDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
public static class NonConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdDt theId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdDt theId, @ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class PlainProviderWithExtendedOperationOnNoType {
|
||||
|
||||
@Operation(name = "plain", idempotent = true)
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider everything(javax.servlet.http.HttpServletRequest theServletRequest, @IdParam ca.uhn.fhir.model.primitive.IdDt theId, @OperationParam(name = "start") DateDt theStart, @OperationParam(name = "end") DateDt theEnd) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ProviderWithExtendedOperationReturningBundle implements IResourceProvider {
|
||||
|
||||
@Operation(name = "everything", idempotent = true)
|
||||
|
@ -502,54 +587,6 @@ public class ServerConformanceProviderDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
public static class ConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdDt theId, @ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdDt theId, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class NonConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdDt theId, @ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdDt theId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
|
|
|
@ -293,6 +293,11 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
} else {
|
||||
for (BaseMethodBinding<?> nextMethodBinding : nextEntry.getValue()) {
|
||||
checkBindingForSystemOps(rest, systemOps, nextMethodBinding);
|
||||
if (nextMethodBinding instanceof OperationMethodBinding) {
|
||||
OperationMethodBinding methodBinding = (OperationMethodBinding) nextMethodBinding;
|
||||
String opName = myOperationBindingToName.get(methodBinding);
|
||||
rest.addOperation().setName(methodBinding.getName()).getDefinition().setReference("OperationDefinition/" + opName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,29 @@ public class ServerConformanceProviderHl7OrgDstu2Test {
|
|||
return sc;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
ConformanceRestResourceComponent res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertTrue(res.getConditionalCreate());
|
||||
assertTrue(res.getConditionalDelete());
|
||||
assertTrue(res.getConditionalUpdate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtendedOperationReturningBundle() throws Exception {
|
||||
|
||||
|
@ -92,6 +115,7 @@ public class ServerConformanceProviderHl7OrgDstu2Test {
|
|||
assertEquals("OperationDefinition/everything", conformance.getRest().get(0).getOperation().get(0).getDefinition().getReference());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testExtendedOperationReturningBundleOperation() throws Exception {
|
||||
|
||||
|
@ -164,6 +188,29 @@ public class ServerConformanceProviderHl7OrgDstu2Test {
|
|||
assertThat(conf, containsString("<type value=\"token\"/>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new NonConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
ConformanceRestResourceComponent res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertNull(res.getConditionalCreateElement().getValue());
|
||||
assertNull(res.getConditionalDeleteElement().getValue());
|
||||
assertNull(res.getConditionalUpdateElement().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperationDocumentation() throws Exception {
|
||||
|
||||
|
@ -197,6 +244,33 @@ public class ServerConformanceProviderHl7OrgDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperationOnNoTypes() throws Exception {
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new PlainProviderWithExtendedOperationOnNoType());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs) {
|
||||
@Override
|
||||
public Conformance getServerConformance(HttpServletRequest theRequest) {
|
||||
return super.getServerConformance(theRequest);
|
||||
}
|
||||
};
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance sconf = sc.getServerConformance(createHttpServletRequest());
|
||||
assertEquals("OperationDefinition/plain", sconf.getRest().get(0).getOperation().get(0).getDefinition().getReference());
|
||||
|
||||
OperationDefinition opDef = sc.readOperationDefinition(new IdDt("OperationDefinition/plain"));
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef);
|
||||
ourLog.info(conf);
|
||||
|
||||
assertEquals("$plain", opDef.getCode());
|
||||
assertEquals(true, opDef.getIdempotent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProviderWithRequiredAndOptional() throws Exception {
|
||||
|
||||
|
@ -267,52 +341,6 @@ public class ServerConformanceProviderHl7OrgDstu2Test {
|
|||
assertThat(conf, containsString("<interaction><code value=\"read\"/></interaction>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
ConformanceRestResourceComponent res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertTrue(res.getConditionalCreate());
|
||||
assertTrue(res.getConditionalDelete());
|
||||
assertTrue(res.getConditionalUpdate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new NonConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
ConformanceRestResourceComponent res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertNull(res.getConditionalCreateElement().getValue());
|
||||
assertNull(res.getConditionalDeleteElement().getValue());
|
||||
assertNull(res.getConditionalUpdateElement().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchParameterDocumentation() throws Exception {
|
||||
|
||||
|
@ -400,6 +428,30 @@ public class ServerConformanceProviderHl7OrgDstu2Test {
|
|||
assertTrue(ourCtx.newValidator().validateWithResult(conformance).isSuccessful());
|
||||
}
|
||||
|
||||
public static class ConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdDt theId, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdDt theId, @ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class InstanceHistoryProvider implements IResourceProvider {
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
|
@ -425,6 +477,39 @@ public class ServerConformanceProviderHl7OrgDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
public static class NonConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdDt theId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdDt theId, @ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class PlainProviderWithExtendedOperationOnNoType {
|
||||
|
||||
@Operation(name = "plain", idempotent = true)
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider everything(javax.servlet.http.HttpServletRequest theServletRequest, @IdParam ca.uhn.fhir.model.primitive.IdDt theId, @OperationParam(name = "start") DateDt theStart, @OperationParam(name = "end") DateDt theEnd) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ProviderWithExtendedOperationReturningBundle implements IResourceProvider {
|
||||
|
||||
@Operation(name = "everything", idempotent = true)
|
||||
|
@ -502,54 +587,6 @@ public class ServerConformanceProviderHl7OrgDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
public static class ConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdDt theId, @ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdDt theId, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class NonConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdDt theId, @ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdDt theId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
|
|
|
@ -98,8 +98,15 @@ public class TinderJpaRestServerMojo extends AbstractMojo {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < baseResourceNames.size(); i++) {
|
||||
baseResourceNames.set(i, baseResourceNames.get(i).toLowerCase());
|
||||
}
|
||||
|
||||
if (excludeResourceNames != null) {
|
||||
for (int i = 0; i < excludeResourceNames.size(); i++) {
|
||||
excludeResourceNames.set(i, excludeResourceNames.get(i).toLowerCase());
|
||||
}
|
||||
baseResourceNames.removeAll(excludeResourceNames);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue