Refactor operations to use constants for their names

This commit is contained in:
James Agnew 2018-05-05 08:27:45 -04:00
parent 127a8389ac
commit 5c505b7cd7
19 changed files with 229 additions and 200 deletions

View File

@ -259,6 +259,10 @@ public abstract class BaseSearchParamRegistry<SP extends IBaseResource> implemen
List<IBaseResource> allSearchParams = allSearchParamsBp.getResources(0, size);
for (IBaseResource nextResource : allSearchParams) {
SP nextSp = (SP) nextResource;
if (nextSp == null) {
continue;
}
RuntimeSearchParam runtimeSp = toRuntimeSp(nextSp);
if (runtimeSp == null) {
continue;
@ -287,7 +291,7 @@ public abstract class BaseSearchParamRegistry<SP extends IBaseResource> implemen
}
if (!activeSearchParams.containsKey(nextEntry.getKey())) {
activeSearchParams.put(nextEntry.getKey(), new HashMap<String, RuntimeSearchParam>());
activeSearchParams.put(nextEntry.getKey(), new HashMap<>());
}
if (activeSearchParams.containsKey(nextEntry.getKey())) {
ourLog.debug("Replacing existing/built in search param {}:{} with new one", nextEntry.getKey(), nextName);

View File

@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.provider;
*/
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoEncounter;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.dstu2.resource.Encounter;
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
@ -35,8 +36,7 @@ public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDs
/**
* Encounter/123/$everything
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -55,7 +55,6 @@ public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDs
@Sort
SortSpec theSortSpec
) {
//@formatter:on
startRequest(theServletRequest);
try {
@ -67,8 +66,7 @@ public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDs
/**
* /Encounter/$everything
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -84,7 +82,6 @@ public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDs
@Sort
SortSpec theSortSpec
) {
//@formatter:on
startRequest(theServletRequest);
try {

View File

@ -25,6 +25,7 @@ import java.util.List;
*/
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoPatient;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.primitive.StringDt;
@ -40,10 +41,8 @@ public class BaseJpaResourceProviderPatientDstu2 extends JpaResourceProviderDstu
/**
* Patient/123/$everything
* @param theRequestDetails
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider patientInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -72,7 +71,6 @@ public class BaseJpaResourceProviderPatientDstu2 extends JpaResourceProviderDstu
RequestDetails theRequestDetails
) {
//@formatter:on
startRequest(theServletRequest);
try {
@ -84,10 +82,8 @@ public class BaseJpaResourceProviderPatientDstu2 extends JpaResourceProviderDstu
/**
* /Patient/$everything
* @param theRequestDetails
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider patientTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -113,7 +109,6 @@ public class BaseJpaResourceProviderPatientDstu2 extends JpaResourceProviderDstu
RequestDetails theRequestDetails
) {
//@formatter:on
startRequest(theServletRequest);
try {

View File

@ -28,6 +28,7 @@ import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem.LookupCodeResult;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.resource.Parameters;
@ -40,8 +41,8 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDstu2<ValueSet> {
//@formatter:off
@Operation(name = "$expand", idempotent = true)
@Operation(name = JpaConstants.OPERATION_EXPAND, idempotent = true)
public ValueSet expand(
HttpServletRequest theServletRequest,
@IdParam(optional=true) IdDt theId,
@ -49,7 +50,6 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
@OperationParam(name="identifier", min=0, max=1) UriDt theIdentifier,
@OperationParam(name = "filter", min=0, max=1) StringDt theFilter,
RequestDetails theRequestDetails) {
//@formatter:on
boolean haveId = theId != null && theId.hasIdPart();
boolean haveIdentifier = theIdentifier != null && isNotBlank(theIdentifier.getValue());
@ -99,8 +99,7 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
return theFilter != null ? theFilter.getValue() : null;
}
//@formatter:off
@Operation(name = "$lookup", idempotent = true, returnParameters= {
@Operation(name = JpaConstants.OPERATION_LOOKUP, idempotent = true, returnParameters= {
@OperationParam(name="name", type=StringDt.class, min=1),
@OperationParam(name="version", type=StringDt.class, min=0),
@OperationParam(name="display", type=StringDt.class, min=1),
@ -113,7 +112,6 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
@OperationParam(name="coding", min=0, max=1) CodingDt theCoding,
RequestDetails theRequestDetails
) {
//@formatter:on
startRequest(theServletRequest);
try {
@ -136,8 +134,7 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
}
//@formatter:off
@Operation(name = "$validate-code", idempotent = true, returnParameters= {
@Operation(name = JpaConstants.OPERATION_VALIDATE_CODE, idempotent = true, returnParameters= {
@OperationParam(name="result", type=BooleanDt.class, min=1),
@OperationParam(name="message", type=StringDt.class),
@OperationParam(name="display", type=StringDt.class)
@ -153,7 +150,6 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
@OperationParam(name="codeableConcept", min=0, max=1) CodeableConceptDt theCodeableConcept,
RequestDetails theRequestDetails
) {
//@formatter:on
startRequest(theServletRequest);
try {

View File

@ -80,7 +80,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
}
}
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerDt.class)
})
public Parameters expunge(
@ -93,7 +93,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
return JpaSystemProviderDstu2.toExpungeResponse(retVal);
}
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerDt.class)
})
public Parameters expunge(

View File

@ -61,7 +61,7 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
@Autowired(required = false)
private IFulltextSearchSvc mySearchDao;
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerDt.class)
})
public Parameters expunge(
@ -75,7 +75,7 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
return toExpungeResponse(retVal);
}
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerDt.class)
})
public Parameters expunge(
@ -91,7 +91,7 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
//@formatter:off
// This is generated by hand:
// ls hapi-fhir-structures-dstu2/target/generated-sources/tinder/ca/uhn/fhir/model/dstu2/resource/ | sort | sed "s/.java//" | sed "s/^/@OperationParam(name=\"/" | sed "s/$/\", type=IntegerDt.class, min=0, max=1),/"
@Operation(name = "$get-resource-counts", idempotent = true, returnParameters = {
@Operation(name = JpaConstants.OPERATION_GET_RESOURCE_COUNTS, idempotent = true, returnParameters = {
@OperationParam(name = "AllergyIntolerance", type = IntegerDt.class, min = 0, max = 1),
@OperationParam(name = "Appointment", type = IntegerDt.class, min = 0, max = 1),
@OperationParam(name = "AppointmentResponse", type = IntegerDt.class, min = 0, max = 1),
@ -199,18 +199,16 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
return retVal;
}
//@formatter:off
@Operation(name = "$meta", idempotent = true, returnParameters = {
@Operation(name = JpaConstants.OPERATION_META, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = MetaDt.class)
})
//@formatter:on
public Parameters meta(RequestDetails theRequestDetails) {
Parameters parameters = new Parameters();
parameters.addParameter().setName("return").setValue(getDao().metaGetOperation(theRequestDetails));
return parameters;
}
@Operation(name = "$suggest-keywords", idempotent = true)
@Operation(name = JpaConstants.OPERATION_SUGGEST_KEYWORDS, idempotent = true)
public Parameters suggestKeywords(
@OperationParam(name = "context", min = 1, max = 1) String theContext,
@OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam,

View File

@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.provider.dstu3;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem.LookupCodeResult;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -36,7 +37,7 @@ import java.util.List;
public class BaseJpaResourceProviderCodeSystemDstu3 extends JpaResourceProviderDstu3<CodeSystem> {
@SuppressWarnings("unchecked")
@Operation(name = "$lookup", idempotent = true, returnParameters= {
@Operation(name = JpaConstants.OPERATION_LOOKUP, idempotent = true, returnParameters= {
@OperationParam(name="name", type=StringType.class, min=1),
@OperationParam(name="version", type=StringType.class, min=0),
@OperationParam(name="display", type=StringType.class, min=1),

View File

@ -1,5 +1,6 @@
package ca.uhn.fhir.jpa.provider.dstu3;
import ca.uhn.fhir.jpa.util.JpaConstants;
import org.hl7.fhir.dstu3.model.*;
/*
@ -36,8 +37,7 @@ public class BaseJpaResourceProviderEncounterDstu3 extends JpaResourceProviderDs
/**
* Encounter/123/$everything
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -56,7 +56,6 @@ public class BaseJpaResourceProviderEncounterDstu3 extends JpaResourceProviderDs
@Sort
SortSpec theSortSpec
) {
//@formatter:on
startRequest(theServletRequest);
try {
@ -68,8 +67,7 @@ public class BaseJpaResourceProviderEncounterDstu3 extends JpaResourceProviderDs
/**
* /Encounter/$everything
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -85,7 +83,6 @@ public class BaseJpaResourceProviderEncounterDstu3 extends JpaResourceProviderDs
@Sort
SortSpec theSortSpec
) {
//@formatter:on
startRequest(theServletRequest);
try {

View File

@ -1,10 +1,29 @@
package ca.uhn.fhir.jpa.provider.dstu3;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoPatient;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.annotation.Sort;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.StringAndListParam;
import ca.uhn.fhir.rest.param.StringOrListParam;
import ca.uhn.fhir.rest.param.StringParam;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.UnsignedIntType;
import java.util.List;
import org.hl7.fhir.dstu3.model.*;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
/*
* #%L
@ -26,24 +45,12 @@ import org.hl7.fhir.dstu3.model.*;
* #L%
*/
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoPatient;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
import ca.uhn.fhir.rest.annotation.*;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.param.*;
public class BaseJpaResourceProviderPatientDstu3 extends JpaResourceProviderDstu3<Patient> {
/**
* Patient/123/$everything
* @param theRequestDetails
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider patientInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -72,7 +79,6 @@ public class BaseJpaResourceProviderPatientDstu3 extends JpaResourceProviderDstu
RequestDetails theRequestDetails
) {
//@formatter:on
startRequest(theServletRequest);
try {
@ -84,10 +90,8 @@ public class BaseJpaResourceProviderPatientDstu3 extends JpaResourceProviderDstu
/**
* /Patient/$everything
* @param theRequestDetails
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider patientTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -113,7 +117,6 @@ public class BaseJpaResourceProviderPatientDstu3 extends JpaResourceProviderDstu
RequestDetails theRequestDetails
) {
//@formatter:on
startRequest(theServletRequest);
try {

View File

@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.provider.dstu3;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
@ -35,7 +36,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDstu3<ValueSet> {
@Operation(name = "$expand", idempotent = true)
@Operation(name = JpaConstants.OPERATION_EXPAND, idempotent = true)
public ValueSet expand(
HttpServletRequest theServletRequest,
@IdParam(optional = true) IdType theId,
@ -87,7 +88,7 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst
@SuppressWarnings("unchecked")
@Operation(name = "$validate-code", idempotent = true, returnParameters = {
@Operation(name = JpaConstants.OPERATION_VALIDATE_CODE, idempotent = true, returnParameters = {
@OperationParam(name = "result", type = BooleanType.class, min = 1),
@OperationParam(name = "message", type = StringType.class),
@OperationParam(name = "display", type = StringType.class)

View File

@ -80,7 +80,7 @@ public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaRes
}
}
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
})
public Parameters expunge(
@ -97,7 +97,7 @@ public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaRes
}
}
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
})
public Parameters expunge(

View File

@ -57,7 +57,7 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
@Autowired(required = false)
private IFulltextSearchSvc mySearchDao;
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
})
public Parameters expunge(
@ -75,7 +75,7 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
}
}
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
})
public Parameters expunge(
@ -92,10 +92,9 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
}
}
//@formatter:off
// This is generated by hand:
// ls hapi-fhir-structures-dstu2/target/generated-sources/tinder/ca/uhn/fhir/model/dstu2/resource/ | sort | sed "s/.java//" | sed "s/^/@OperationParam(name=\"/" | sed "s/$/\", type=IntegerType.class, min=0, max=1),/"
@Operation(name = "$get-resource-counts", idempotent = true, returnParameters = {
@Operation(name = JpaConstants.OPERATION_GET_RESOURCE_COUNTS, idempotent = true, returnParameters = {
@OperationParam(name = "AllergyIntolerance", type = IntegerType.class, min = 0, max = 1),
@OperationParam(name = "Appointment", type = IntegerType.class, min = 0, max = 1),
@OperationParam(name = "AppointmentResponse", type = IntegerType.class, min = 0, max = 1),
@ -189,7 +188,6 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
@OperationParam(name = "VisionPrescription", type = IntegerType.class, min = 0, max = 1)
})
@Description(shortDefinition = "Provides the number of resources currently stored on the server, broken down by resource type")
//@formatter:on
public Parameters getResourceCounts() {
Parameters retVal = new Parameters();
@ -203,18 +201,16 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
return retVal;
}
//@formatter:off
@Operation(name = "$meta", idempotent = true, returnParameters = {
@Operation(name = JpaConstants.OPERATION_META, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = Meta.class)
})
//@formatter:on
public Parameters meta(RequestDetails theRequestDetails) {
Parameters parameters = new Parameters();
parameters.addParameter().setName("return").setValue(getDao().metaGetOperation(theRequestDetails));
return parameters;
}
@Operation(name = "$suggest-keywords", idempotent = true)
@Operation(name = JpaConstants.OPERATION_SUGGEST_KEYWORDS, idempotent = true)
public Parameters suggestKeywords(
@OperationParam(name = "context", min = 1, max = 1) String theContext,
@OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam,
@ -236,11 +232,9 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
Parameters retVal = new Parameters();
for (Suggestion next : keywords) {
//@formatter:off
retVal.addParameter()
.addPart(new ParametersParameterComponent().setName("keyword").setValue(new StringType(next.getTerm())))
.addPart(new ParametersParameterComponent().setName("score").setValue(new DecimalType(next.getScore())));
//@formatter:on
}
return retVal;

View File

@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.provider.r4;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem.LookupCodeResult;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -33,7 +34,7 @@ import java.util.List;
public class BaseJpaResourceProviderCodeSystemR4 extends JpaResourceProviderR4<CodeSystem> {
@SuppressWarnings("unchecked")
@Operation(name = "$lookup", idempotent = true, returnParameters= {
@Operation(name = JpaConstants.OPERATION_LOOKUP, idempotent = true, returnParameters= {
@OperationParam(name="name", type=StringType.class, min=1),
@OperationParam(name="version", type=StringType.class, min=0),
@OperationParam(name="display", type=StringType.class, min=1),

View File

@ -1,5 +1,6 @@
package ca.uhn.fhir.jpa.provider.r4;
import ca.uhn.fhir.jpa.util.JpaConstants;
import org.hl7.fhir.r4.model.*;
/*
@ -36,8 +37,7 @@ public class BaseJpaResourceProviderEncounterR4 extends JpaResourceProviderR4<En
/**
* Encounter/123/$everything
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -56,7 +56,6 @@ public class BaseJpaResourceProviderEncounterR4 extends JpaResourceProviderR4<En
@Sort
SortSpec theSortSpec
) {
//@formatter:on
startRequest(theServletRequest);
try {
@ -68,8 +67,7 @@ public class BaseJpaResourceProviderEncounterR4 extends JpaResourceProviderR4<En
/**
* /Encounter/$everything
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -85,7 +83,6 @@ public class BaseJpaResourceProviderEncounterR4 extends JpaResourceProviderR4<En
@Sort
SortSpec theSortSpec
) {
//@formatter:on
startRequest(theServletRequest);
try {

View File

@ -1,10 +1,29 @@
package ca.uhn.fhir.jpa.provider.r4;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoPatient;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.annotation.Sort;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.StringAndListParam;
import ca.uhn.fhir.rest.param.StringOrListParam;
import ca.uhn.fhir.rest.param.StringParam;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.UnsignedIntType;
import java.util.List;
import org.hl7.fhir.r4.model.*;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
/*
* #%L
@ -26,24 +45,12 @@ import org.hl7.fhir.r4.model.*;
* #L%
*/
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoPatient;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
import ca.uhn.fhir.rest.annotation.*;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.param.*;
public class BaseJpaResourceProviderPatientR4 extends JpaResourceProviderR4<Patient> {
/**
* Patient/123/$everything
* @param theRequestDetails
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider patientInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -72,7 +79,6 @@ public class BaseJpaResourceProviderPatientR4 extends JpaResourceProviderR4<Pati
RequestDetails theRequestDetails
) {
//@formatter:on
startRequest(theServletRequest);
try {
@ -84,10 +90,8 @@ public class BaseJpaResourceProviderPatientR4 extends JpaResourceProviderR4<Pati
/**
* /Patient/$everything
* @param theRequestDetails
*/
//@formatter:off
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider patientTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest,
@ -113,7 +117,6 @@ public class BaseJpaResourceProviderPatientR4 extends JpaResourceProviderR4<Pati
RequestDetails theRequestDetails
) {
//@formatter:on
startRequest(theServletRequest);
try {

View File

@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.provider.r4;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
@ -35,7 +36,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class BaseJpaResourceProviderValueSetR4 extends JpaResourceProviderR4<ValueSet> {
@Operation(name = "$expand", idempotent = true)
@Operation(name = JpaConstants.OPERATION_EXPAND, idempotent = true)
public ValueSet expand(
HttpServletRequest theServletRequest,
@IdParam(optional = true) IdType theId,
@ -79,7 +80,7 @@ public class BaseJpaResourceProviderValueSetR4 extends JpaResourceProviderR4<Val
@SuppressWarnings("unchecked")
@Operation(name = "$validate-code", idempotent = true, returnParameters = {
@Operation(name = JpaConstants.OPERATION_VALIDATE_CODE, idempotent = true, returnParameters = {
@OperationParam(name = "result", type = BooleanType.class, min = 1),
@OperationParam(name = "message", type = StringType.class),
@OperationParam(name = "display", type = StringType.class)

View File

@ -77,7 +77,7 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
}
}
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
})
public Parameters expunge(
@ -89,7 +89,7 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
return super.doExpunge(theIdParam, theLimit, theExpungeDeletedResources, theExpungeOldVersions, null);
}
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
})
public Parameters expunge(

View File

@ -54,7 +54,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
@Autowired(required = false)
private IFulltextSearchSvc mySearchDao;
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
})
public Parameters expunge(
@ -67,7 +67,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
return super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
}
@Operation(name = JpaConstants.OPERATION_NAME_EXPUNGE, idempotent = false, returnParameters = {
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
})
public Parameters expunge(
@ -79,10 +79,9 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
return super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
}
//@formatter:off
// This is generated by hand:
// ls hapi-fhir-structures-dstu2/target/generated-sources/tinder/ca/uhn/fhir/model/dstu2/resource/ | sort | sed "s/.java//" | sed "s/^/@OperationParam(name=\"/" | sed "s/$/\", type=IntegerType.class, min=0, max=1),/"
@Operation(name = "$get-resource-counts", idempotent = true, returnParameters = {
@Operation(name = JpaConstants.OPERATION_GET_RESOURCE_COUNTS, idempotent = true, returnParameters = {
@OperationParam(name = "AllergyIntolerance", type = IntegerType.class, min = 0, max = 1),
@OperationParam(name = "Appointment", type = IntegerType.class, min = 0, max = 1),
@OperationParam(name = "AppointmentResponse", type = IntegerType.class, min = 0, max = 1),
@ -189,7 +188,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
return retVal;
}
@Operation(name = "$meta", idempotent = true, returnParameters = {
@Operation(name = JpaConstants.OPERATION_META, idempotent = true, returnParameters = {
@OperationParam(name = "return", type = Meta.class)
})
public Parameters meta(RequestDetails theRequestDetails) {
@ -198,7 +197,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
return parameters;
}
@Operation(name = "$suggest-keywords", idempotent = true)
@Operation(name = JpaConstants.OPERATION_SUGGEST_KEYWORDS, idempotent = true)
public Parameters suggestKeywords(
@OperationParam(name = "context", min = 1, max = 1) String theContext,
@OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam,

View File

@ -71,7 +71,14 @@ public class JpaConstants {
/**
* Operation name for the $expunge operation
*/
public static final String OPERATION_NAME_EXPUNGE = "$expunge";
public static final String OPERATION_EXPUNGE = "$expunge";
/**
* @deprecated Replace with {@link #OPERATION_EXPUNGE}
*/
@Deprecated
public static final String OPERATION_NAME_EXPUNGE = OPERATION_EXPUNGE;
/**
* Parameter name for the $expunge operation
*/
@ -99,4 +106,39 @@ public class JpaConstants {
* be removed if they are nt explicitly included in updates
*/
public static final String HEADER_META_SNAPSHOT_MODE = "X-Meta-Snapshot-Mode";
/**
* Operation name for the $lookup operation
*/
public static final String OPERATION_LOOKUP = "$lookup";
/**
* Operation name for the $expand operation
*/
public static final String OPERATION_EXPAND = "$expand";
/**
* Operation name for the $validate-code operation
*/
public static final String OPERATION_VALIDATE_CODE = "$validate-code";
/**
* Operation name for the $get-resource-counts operation
*/
public static final String OPERATION_GET_RESOURCE_COUNTS = "$get-resource-counts";
/**
* Operation name for the $meta operation
*/
public static final String OPERATION_META = "$meta";
/**
* Operation name for the $suggest-keywords operation
*/
public static final String OPERATION_SUGGEST_KEYWORDS = "$suggest-keywords";
/**
* Operation name for the $everything operation
*/
public static final String OPERATION_EVERYTHING = "$everything";
}