Move a few more constants around

This commit is contained in:
James Agnew 2018-05-05 12:21:56 -04:00
parent 5c505b7cd7
commit a0c40cf98a
6 changed files with 44 additions and 36 deletions

View File

@ -38,11 +38,9 @@ import org.hl7.fhir.instance.model.api.IIdType;
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 static final String OPERATION_NAME_META_DELETE = "$meta-delete";
public static final String OPERATION_NAME_META_ADD = "$meta-add";
public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResourceProvider<T> {
public JpaResourceProviderDstu2() {
// nothing
@ -105,7 +103,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
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)
})
public Parameters meta(RequestDetails theRequestDetails) {
@ -115,7 +113,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
return parameters;
}
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = MetaDt.class)
})
public Parameters meta(@IdParam IdDt theId, RequestDetails theRequestDetails) {
@ -125,7 +123,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
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)
})
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;
}
@Operation(name = OPERATION_NAME_META_DELETE, idempotent = true, returnParameters = {
@Operation(name = OPERATION_META_DELETE, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = MetaDt.class)
})
public Parameters metaDelete(@IdParam IdDt theId, @OperationParam(name = "meta") MetaDt theMeta, RequestDetails theRequestDetails) {

View File

@ -38,11 +38,11 @@ import org.hl7.fhir.instance.model.api.IIdType;
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 static final String OPERATION_NAME_META_DELETE = "$meta-delete";
public static final String OPERATION_NAME_META_ADD = "$meta-add";
public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaResourceProvider<T> {
public JpaResourceProviderDstu3() {
// nothing
@ -113,11 +113,9 @@ public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaRes
}
}
//@formatter:off
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = Meta.class)
})
//@formatter:on
public Parameters meta(RequestDetails theRequestDetails) {
Parameters parameters = new Parameters();
Meta metaGetOperation = getDao().metaGetOperation(Meta.class, theRequestDetails);
@ -125,11 +123,9 @@ public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaRes
return parameters;
}
//@formatter:off
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = Meta.class)
})
//@formatter:on
public Parameters meta(@IdParam IdType theId, RequestDetails theRequestDetails) {
Parameters parameters = new Parameters();
Meta metaGetOperation = getDao().metaGetOperation(Meta.class, theId, theRequestDetails);
@ -137,7 +133,7 @@ public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaRes
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)
})
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;
}
@Operation(name = OPERATION_NAME_META_DELETE, idempotent = true, returnParameters = {
@Operation(name = OPERATION_META_DELETE, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = Meta.class)
})
public Parameters metaDelete(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {

View File

@ -35,11 +35,11 @@ import org.hl7.fhir.r4.model.*;
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 static final String OPERATION_NAME_META_DELETE = "$meta-delete";
public static final String OPERATION_NAME_META_ADD = "$meta-add";
public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResourceProvider<T> {
public JpaResourceProviderR4() {
// nothing
@ -100,7 +100,7 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
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)
})
public Parameters meta(RequestDetails theRequestDetails) {
@ -110,11 +110,9 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
return parameters;
}
//@formatter:off
@Operation(name = OPERATION_NAME_META, idempotent = true, returnParameters = {
@Operation(name = OPERATION_META, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = Meta.class)
})
//@formatter:on
public Parameters meta(@IdParam IdType theId, RequestDetails theRequestDetails) {
Parameters parameters = new Parameters();
Meta metaGetOperation = getDao().metaGetOperation(Meta.class, theId, theRequestDetails);
@ -122,11 +120,9 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
return parameters;
}
//@formatter:off
@Operation(name = OPERATION_NAME_META_ADD, idempotent = true, returnParameters = {
@Operation(name = OPERATION_META_ADD, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = Meta.class)
})
//@formatter:on
public Parameters metaAdd(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
if (theMeta == null) {
throw new InvalidRequestException("Input contains no parameter with name 'meta'");
@ -137,11 +133,9 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
return parameters;
}
//@formatter:off
@Operation(name = OPERATION_NAME_META_DELETE, idempotent = true, returnParameters = {
@Operation(name = OPERATION_META_DELETE, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = Meta.class)
})
//@formatter:on
public Parameters metaDelete(@IdParam IdType theId, @OperationParam(name = "meta") Meta theMeta, RequestDetails theRequestDetails) {
if (theMeta == null) {
throw new InvalidRequestException("Input contains no parameter with name 'meta'");

View File

@ -20,6 +20,8 @@ package ca.uhn.fhir.jpa.util;
* #L%
*/
import ca.uhn.fhir.rest.api.Constants;
public class JpaConstants {
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";
/**
* 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
*/
@ -141,4 +149,15 @@ public class JpaConstants {
* Operation name for the $everything operation
*/
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";
}

View File

@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.entity.ResourceHistoryTable;
import ca.uhn.fhir.jpa.entity.Search;
import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.util.StopWatch;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.primitive.InstantDt;
@ -1561,7 +1562,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testExtensionUrlWithHl7Url() throws IOException {
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));
CloseableHttpResponse resp = ourHttpClient.execute(post);

View File

@ -1312,7 +1312,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.14</version>
<version>1.16</version>
<configuration>
<verbose>true</verbose>
<addSvnKeyWords>false</addSvnKeyWords>