Move a few more constants around
This commit is contained in:
parent
5c505b7cd7
commit
a0c40cf98a
|
@ -38,11 +38,9 @@ import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResourceProvider<T> {
|
import static ca.uhn.fhir.jpa.util.JpaConstants.*;
|
||||||
|
|
||||||
public static final String OPERATION_NAME_META = "$meta";
|
public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResourceProvider<T> {
|
||||||
public static final String OPERATION_NAME_META_DELETE = "$meta-delete";
|
|
||||||
public static final String OPERATION_NAME_META_ADD = "$meta-add";
|
|
||||||
|
|
||||||
public JpaResourceProviderDstu2() {
|
public JpaResourceProviderDstu2() {
|
||||||
// nothing
|
// nothing
|
||||||
|
@ -105,7 +103,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
|
||||||
return JpaSystemProviderDstu2.toExpungeResponse(retVal);
|
return JpaSystemProviderDstu2.toExpungeResponse(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
|
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
|
||||||
@OperationParam(name = "return", type = MetaDt.class)
|
@OperationParam(name = "return", type = MetaDt.class)
|
||||||
})
|
})
|
||||||
public Parameters meta(RequestDetails theRequestDetails) {
|
public Parameters meta(RequestDetails theRequestDetails) {
|
||||||
|
@ -115,7 +113,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
|
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
|
||||||
@OperationParam(name = "return", type = MetaDt.class)
|
@OperationParam(name = "return", type = MetaDt.class)
|
||||||
})
|
})
|
||||||
public Parameters meta(@IdParam IdDt theId, RequestDetails theRequestDetails) {
|
public Parameters meta(@IdParam IdDt theId, RequestDetails theRequestDetails) {
|
||||||
|
@ -125,7 +123,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(name = OPERATION_NAME_META_ADD, idempotent = true, returnParameters = {
|
@Operation(name = OPERATION_META_ADD, idempotent = true, returnParameters = {
|
||||||
@OperationParam(name = "return", type = MetaDt.class)
|
@OperationParam(name = "return", type = MetaDt.class)
|
||||||
})
|
})
|
||||||
public Parameters metaAdd(@IdParam IdDt theId, @OperationParam(name = "meta") MetaDt theMeta, RequestDetails theRequestDetails) {
|
public Parameters metaAdd(@IdParam IdDt theId, @OperationParam(name = "meta") MetaDt theMeta, RequestDetails theRequestDetails) {
|
||||||
|
@ -138,7 +136,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(name = OPERATION_NAME_META_DELETE, idempotent = true, returnParameters = {
|
@Operation(name = OPERATION_META_DELETE, idempotent = true, returnParameters = {
|
||||||
@OperationParam(name = "return", type = MetaDt.class)
|
@OperationParam(name = "return", type = MetaDt.class)
|
||||||
})
|
})
|
||||||
public Parameters metaDelete(@IdParam IdDt theId, @OperationParam(name = "meta") MetaDt theMeta, RequestDetails theRequestDetails) {
|
public Parameters metaDelete(@IdParam IdDt theId, @OperationParam(name = "meta") MetaDt theMeta, RequestDetails theRequestDetails) {
|
||||||
|
|
|
@ -38,11 +38,11 @@ import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaResourceProvider<T> {
|
import static ca.uhn.fhir.jpa.util.JpaConstants.OPERATION_META;
|
||||||
|
import static ca.uhn.fhir.jpa.util.JpaConstants.OPERATION_META_ADD;
|
||||||
|
import static ca.uhn.fhir.jpa.util.JpaConstants.OPERATION_META_DELETE;
|
||||||
|
|
||||||
public static final String OPERATION_NAME_META = "$meta";
|
public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaResourceProvider<T> {
|
||||||
public static final String OPERATION_NAME_META_DELETE = "$meta-delete";
|
|
||||||
public static final String OPERATION_NAME_META_ADD = "$meta-add";
|
|
||||||
|
|
||||||
public JpaResourceProviderDstu3() {
|
public JpaResourceProviderDstu3() {
|
||||||
// nothing
|
// nothing
|
||||||
|
@ -113,11 +113,9 @@ public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaRes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@formatter:off
|
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
|
||||||
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
|
|
||||||
@OperationParam(name = "return", type = Meta.class)
|
@OperationParam(name = "return", type = Meta.class)
|
||||||
})
|
})
|
||||||
//@formatter:on
|
|
||||||
public Parameters meta(RequestDetails theRequestDetails) {
|
public Parameters meta(RequestDetails theRequestDetails) {
|
||||||
Parameters parameters = new Parameters();
|
Parameters parameters = new Parameters();
|
||||||
Meta metaGetOperation = getDao().metaGetOperation(Meta.class, theRequestDetails);
|
Meta metaGetOperation = getDao().metaGetOperation(Meta.class, theRequestDetails);
|
||||||
|
@ -125,11 +123,9 @@ public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaRes
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@formatter:off
|
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
|
||||||
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
|
|
||||||
@OperationParam(name = "return", type = Meta.class)
|
@OperationParam(name = "return", type = Meta.class)
|
||||||
})
|
})
|
||||||
//@formatter:on
|
|
||||||
public Parameters meta(@IdParam IdType theId, RequestDetails theRequestDetails) {
|
public Parameters meta(@IdParam IdType theId, RequestDetails theRequestDetails) {
|
||||||
Parameters parameters = new Parameters();
|
Parameters parameters = new Parameters();
|
||||||
Meta metaGetOperation = getDao().metaGetOperation(Meta.class, theId, theRequestDetails);
|
Meta metaGetOperation = getDao().metaGetOperation(Meta.class, theId, theRequestDetails);
|
||||||
|
@ -137,7 +133,7 @@ public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaRes
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(name = OPERATION_NAME_META_ADD, idempotent = true, returnParameters = {
|
@Operation(name = OPERATION_META_ADD, idempotent = true, returnParameters = {
|
||||||
@OperationParam(name = "return", type = Meta.class)
|
@OperationParam(name = "return", type = Meta.class)
|
||||||
})
|
})
|
||||||
public Parameters metaAdd(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
|
public Parameters metaAdd(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
|
||||||
|
@ -150,7 +146,7 @@ public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaRes
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(name = OPERATION_NAME_META_DELETE, idempotent = true, returnParameters = {
|
@Operation(name = OPERATION_META_DELETE, idempotent = true, returnParameters = {
|
||||||
@OperationParam(name = "return", type = Meta.class)
|
@OperationParam(name = "return", type = Meta.class)
|
||||||
})
|
})
|
||||||
public Parameters metaDelete(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
|
public Parameters metaDelete(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
|
||||||
|
|
|
@ -35,11 +35,11 @@ import org.hl7.fhir.r4.model.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResourceProvider<T> {
|
import static ca.uhn.fhir.jpa.util.JpaConstants.OPERATION_META;
|
||||||
|
import static ca.uhn.fhir.jpa.util.JpaConstants.OPERATION_META_ADD;
|
||||||
|
import static ca.uhn.fhir.jpa.util.JpaConstants.OPERATION_META_DELETE;
|
||||||
|
|
||||||
public static final String OPERATION_NAME_META = "$meta";
|
public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResourceProvider<T> {
|
||||||
public static final String OPERATION_NAME_META_DELETE = "$meta-delete";
|
|
||||||
public static final String OPERATION_NAME_META_ADD = "$meta-add";
|
|
||||||
|
|
||||||
public JpaResourceProviderR4() {
|
public JpaResourceProviderR4() {
|
||||||
// nothing
|
// nothing
|
||||||
|
@ -100,7 +100,7 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
|
||||||
return super.doExpunge(null, theLimit, theExpungeDeletedResources, theExpungeOldVersions, null);
|
return super.doExpunge(null, theLimit, theExpungeDeletedResources, theExpungeOldVersions, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
|
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
|
||||||
@OperationParam(name = "return", type = Meta.class)
|
@OperationParam(name = "return", type = Meta.class)
|
||||||
})
|
})
|
||||||
public Parameters meta(RequestDetails theRequestDetails) {
|
public Parameters meta(RequestDetails theRequestDetails) {
|
||||||
|
@ -110,11 +110,9 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@formatter:off
|
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
|
||||||
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
|
|
||||||
@OperationParam(name = "return", type = Meta.class)
|
@OperationParam(name = "return", type = Meta.class)
|
||||||
})
|
})
|
||||||
//@formatter:on
|
|
||||||
public Parameters meta(@IdParam IdType theId, RequestDetails theRequestDetails) {
|
public Parameters meta(@IdParam IdType theId, RequestDetails theRequestDetails) {
|
||||||
Parameters parameters = new Parameters();
|
Parameters parameters = new Parameters();
|
||||||
Meta metaGetOperation = getDao().metaGetOperation(Meta.class, theId, theRequestDetails);
|
Meta metaGetOperation = getDao().metaGetOperation(Meta.class, theId, theRequestDetails);
|
||||||
|
@ -122,11 +120,9 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@formatter:off
|
@Operation(name = OPERATION_META_ADD, idempotent = true, returnParameters = {
|
||||||
@Operation(name = OPERATION_NAME_META_ADD, idempotent = true, returnParameters = {
|
|
||||||
@OperationParam(name = "return", type = Meta.class)
|
@OperationParam(name = "return", type = Meta.class)
|
||||||
})
|
})
|
||||||
//@formatter:on
|
|
||||||
public Parameters metaAdd(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
|
public Parameters metaAdd(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
|
||||||
if (theMeta == null) {
|
if (theMeta == null) {
|
||||||
throw new InvalidRequestException("Input contains no parameter with name 'meta'");
|
throw new InvalidRequestException("Input contains no parameter with name 'meta'");
|
||||||
|
@ -137,11 +133,9 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@formatter:off
|
@Operation(name = OPERATION_META_DELETE, idempotent = true, returnParameters = {
|
||||||
@Operation(name = OPERATION_NAME_META_DELETE, idempotent = true, returnParameters = {
|
|
||||||
@OperationParam(name = "return", type = Meta.class)
|
@OperationParam(name = "return", type = Meta.class)
|
||||||
})
|
})
|
||||||
//@formatter:on
|
|
||||||
public Parameters metaDelete(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
|
public Parameters metaDelete(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
|
||||||
if (theMeta == null) {
|
if (theMeta == null) {
|
||||||
throw new InvalidRequestException("Input contains no parameter with name 'meta'");
|
throw new InvalidRequestException("Input contains no parameter with name 'meta'");
|
||||||
|
|
|
@ -20,6 +20,8 @@ package ca.uhn.fhir.jpa.util;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
|
||||||
public class JpaConstants {
|
public class JpaConstants {
|
||||||
|
|
||||||
public static final String EXT_SP_UNIQUE = "http://hapifhir.io/fhir/StructureDefinition/sp-unique";
|
public static final String EXT_SP_UNIQUE = "http://hapifhir.io/fhir/StructureDefinition/sp-unique";
|
||||||
|
@ -132,6 +134,12 @@ public class JpaConstants {
|
||||||
*/
|
*/
|
||||||
public static final String OPERATION_META = "$meta";
|
public static final String OPERATION_META = "$meta";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operation name for the $validate operation
|
||||||
|
*/
|
||||||
|
// NB don't delete this, it's used in Smile as well, even though hapi-fhir-server uses the version from Constants.java
|
||||||
|
public static final String OPERATION_VALIDATE = Constants.EXTOP_VALIDATE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operation name for the $suggest-keywords operation
|
* Operation name for the $suggest-keywords operation
|
||||||
*/
|
*/
|
||||||
|
@ -141,4 +149,15 @@ public class JpaConstants {
|
||||||
* Operation name for the $everything operation
|
* Operation name for the $everything operation
|
||||||
*/
|
*/
|
||||||
public static final String OPERATION_EVERYTHING = "$everything";
|
public static final String OPERATION_EVERYTHING = "$everything";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operation name for the $meta-delete operation
|
||||||
|
*/
|
||||||
|
public static final String OPERATION_META_DELETE = "$meta-delete";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operation name for the $meta-add operation
|
||||||
|
*/
|
||||||
|
public static final String OPERATION_META_ADD = "$meta-add";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceHistoryTable;
|
import ca.uhn.fhir.jpa.entity.ResourceHistoryTable;
|
||||||
import ca.uhn.fhir.jpa.entity.Search;
|
import ca.uhn.fhir.jpa.entity.Search;
|
||||||
import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
|
import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
|
||||||
|
import ca.uhn.fhir.jpa.util.JpaConstants;
|
||||||
import ca.uhn.fhir.util.StopWatch;
|
import ca.uhn.fhir.util.StopWatch;
|
||||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||||
|
@ -1561,7 +1562,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
public void testExtensionUrlWithHl7Url() throws IOException {
|
public void testExtensionUrlWithHl7Url() throws IOException {
|
||||||
String input = IOUtils.toString(ResourceProviderR4Test.class.getResourceAsStream("/bug872-ext-with-hl7-url.json"), Charsets.UTF_8);
|
String input = IOUtils.toString(ResourceProviderR4Test.class.getResourceAsStream("/bug872-ext-with-hl7-url.json"), Charsets.UTF_8);
|
||||||
|
|
||||||
HttpPost post = new HttpPost(ourServerBase + "/Patient/$validate");
|
HttpPost post = new HttpPost(ourServerBase + "/Patient/" + JpaConstants.OPERATION_VALIDATE);
|
||||||
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));
|
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));
|
||||||
|
|
||||||
CloseableHttpResponse resp = ourHttpClient.execute(post);
|
CloseableHttpResponse resp = ourHttpClient.execute(post);
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -1312,7 +1312,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>license-maven-plugin</artifactId>
|
<artifactId>license-maven-plugin</artifactId>
|
||||||
<version>1.14</version>
|
<version>1.16</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<verbose>true</verbose>
|
<verbose>true</verbose>
|
||||||
<addSvnKeyWords>false</addSvnKeyWords>
|
<addSvnKeyWords>false</addSvnKeyWords>
|
||||||
|
|
Loading…
Reference in New Issue