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); List<IBaseResource> allSearchParams = allSearchParamsBp.getResources(0, size);
for (IBaseResource nextResource : allSearchParams) { for (IBaseResource nextResource : allSearchParams) {
SP nextSp = (SP) nextResource; SP nextSp = (SP) nextResource;
if (nextSp == null) {
continue;
}
RuntimeSearchParam runtimeSp = toRuntimeSp(nextSp); RuntimeSearchParam runtimeSp = toRuntimeSp(nextSp);
if (runtimeSp == null) { if (runtimeSp == null) {
continue; continue;
@ -287,7 +291,7 @@ public abstract class BaseSearchParamRegistry<SP extends IBaseResource> implemen
} }
if (!activeSearchParams.containsKey(nextEntry.getKey())) { if (!activeSearchParams.containsKey(nextEntry.getKey())) {
activeSearchParams.put(nextEntry.getKey(), new HashMap<String, RuntimeSearchParam>()); activeSearchParams.put(nextEntry.getKey(), new HashMap<>());
} }
if (activeSearchParams.containsKey(nextEntry.getKey())) { if (activeSearchParams.containsKey(nextEntry.getKey())) {
ourLog.debug("Replacing existing/built in search param {}:{} with new one", nextEntry.getKey(), nextName); 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.dao.IFhirResourceDaoEncounter;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.dstu2.resource.Encounter; import ca.uhn.fhir.model.dstu2.resource.Encounter;
import ca.uhn.fhir.model.valueset.BundleTypeEnum; import ca.uhn.fhir.model.valueset.BundleTypeEnum;
@ -35,8 +36,7 @@ public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDs
/** /**
* Encounter/123/$everything * Encounter/123/$everything
*/ */
//@formatter:off @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterInstanceEverything( public IBundleProvider EncounterInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletRequest theServletRequest,
@ -55,7 +55,6 @@ public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDs
@Sort @Sort
SortSpec theSortSpec SortSpec theSortSpec
) { ) {
//@formatter:on
startRequest(theServletRequest); startRequest(theServletRequest);
try { try {
@ -67,8 +66,7 @@ public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDs
/** /**
* /Encounter/$everything * /Encounter/$everything
*/ */
//@formatter:off @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterTypeEverything( public IBundleProvider EncounterTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletRequest theServletRequest,
@ -84,7 +82,6 @@ public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDs
@Sort @Sort
SortSpec theSortSpec SortSpec theSortSpec
) { ) {
//@formatter:on
startRequest(theServletRequest); startRequest(theServletRequest);
try { try {

View File

@ -25,6 +25,7 @@ import java.util.List;
*/ */
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoPatient; 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.api.annotation.Description;
import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
@ -40,10 +41,8 @@ public class BaseJpaResourceProviderPatientDstu2 extends JpaResourceProviderDstu
/** /**
* Patient/123/$everything * Patient/123/$everything
* @param theRequestDetails
*/ */
//@formatter:off @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider patientInstanceEverything( public IBundleProvider patientInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletRequest theServletRequest,
@ -72,7 +71,6 @@ public class BaseJpaResourceProviderPatientDstu2 extends JpaResourceProviderDstu
RequestDetails theRequestDetails RequestDetails theRequestDetails
) { ) {
//@formatter:on
startRequest(theServletRequest); startRequest(theServletRequest);
try { try {
@ -84,10 +82,8 @@ public class BaseJpaResourceProviderPatientDstu2 extends JpaResourceProviderDstu
/** /**
* /Patient/$everything * /Patient/$everything
* @param theRequestDetails
*/ */
//@formatter:off @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider patientTypeEverything( public IBundleProvider patientTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletRequest theServletRequest,
@ -113,7 +109,6 @@ public class BaseJpaResourceProviderPatientDstu2 extends JpaResourceProviderDstu
RequestDetails theRequestDetails RequestDetails theRequestDetails
) { ) {
//@formatter:on
startRequest(theServletRequest); startRequest(theServletRequest);
try { 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.IFhirResourceDaoCodeSystem.LookupCodeResult;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult; 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.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.resource.Parameters; 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> { public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDstu2<ValueSet> {
//@formatter:off
@Operation(name = "$expand", idempotent = true) @Operation(name = JpaConstants.OPERATION_EXPAND, idempotent = true)
public ValueSet expand( public ValueSet expand(
HttpServletRequest theServletRequest, HttpServletRequest theServletRequest,
@IdParam(optional=true) IdDt theId, @IdParam(optional=true) IdDt theId,
@ -49,8 +50,7 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
@OperationParam(name="identifier", min=0, max=1) UriDt theIdentifier, @OperationParam(name="identifier", min=0, max=1) UriDt theIdentifier,
@OperationParam(name = "filter", min=0, max=1) StringDt theFilter, @OperationParam(name = "filter", min=0, max=1) StringDt theFilter,
RequestDetails theRequestDetails) { RequestDetails theRequestDetails) {
//@formatter:on
boolean haveId = theId != null && theId.hasIdPart(); boolean haveId = theId != null && theId.hasIdPart();
boolean haveIdentifier = theIdentifier != null && isNotBlank(theIdentifier.getValue()); boolean haveIdentifier = theIdentifier != null && isNotBlank(theIdentifier.getValue());
boolean haveValueSet = theValueSet != null && theValueSet.isEmpty() == false; boolean haveValueSet = theValueSet != null && theValueSet.isEmpty() == false;
@ -99,8 +99,7 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
return theFilter != null ? theFilter.getValue() : null; return theFilter != null ? theFilter.getValue() : null;
} }
//@formatter:off @Operation(name = JpaConstants.OPERATION_LOOKUP, idempotent = true, returnParameters= {
@Operation(name = "$lookup", idempotent = true, returnParameters= {
@OperationParam(name="name", type=StringDt.class, min=1), @OperationParam(name="name", type=StringDt.class, min=1),
@OperationParam(name="version", type=StringDt.class, min=0), @OperationParam(name="version", type=StringDt.class, min=0),
@OperationParam(name="display", type=StringDt.class, min=1), @OperationParam(name="display", type=StringDt.class, min=1),
@ -113,8 +112,7 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
@OperationParam(name="coding", min=0, max=1) CodingDt theCoding, @OperationParam(name="coding", min=0, max=1) CodingDt theCoding,
RequestDetails theRequestDetails RequestDetails theRequestDetails
) { ) {
//@formatter:on
startRequest(theServletRequest); startRequest(theServletRequest);
try { try {
IFhirResourceDaoCodeSystem<ValueSet, CodingDt, CodeableConceptDt> dao = (IFhirResourceDaoCodeSystem<ValueSet, CodingDt, CodeableConceptDt>) getDao(); IFhirResourceDaoCodeSystem<ValueSet, CodingDt, CodeableConceptDt> dao = (IFhirResourceDaoCodeSystem<ValueSet, CodingDt, CodeableConceptDt>) getDao();
@ -136,8 +134,7 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
} }
//@formatter:off @Operation(name = JpaConstants.OPERATION_VALIDATE_CODE, idempotent = true, returnParameters= {
@Operation(name = "$validate-code", idempotent = true, returnParameters= {
@OperationParam(name="result", type=BooleanDt.class, min=1), @OperationParam(name="result", type=BooleanDt.class, min=1),
@OperationParam(name="message", type=StringDt.class), @OperationParam(name="message", type=StringDt.class),
@OperationParam(name="display", type=StringDt.class) @OperationParam(name="display", type=StringDt.class)
@ -153,8 +150,7 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst
@OperationParam(name="codeableConcept", min=0, max=1) CodeableConceptDt theCodeableConcept, @OperationParam(name="codeableConcept", min=0, max=1) CodeableConceptDt theCodeableConcept,
RequestDetails theRequestDetails RequestDetails theRequestDetails
) { ) {
//@formatter:on
startRequest(theServletRequest); startRequest(theServletRequest);
try { try {
IFhirResourceDaoValueSet<ValueSet, CodingDt, CodeableConceptDt> dao = (IFhirResourceDaoValueSet<ValueSet, CodingDt, CodeableConceptDt>) getDao(); IFhirResourceDaoValueSet<ValueSet, CodingDt, CodeableConceptDt> dao = (IFhirResourceDaoValueSet<ValueSet, CodingDt, CodeableConceptDt>) getDao();

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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerDt.class)
}) })
public Parameters expunge( public Parameters expunge(
@ -93,7 +93,7 @@ public class JpaResourceProviderDstu2<T extends IResource> extends BaseJpaResour
return JpaSystemProviderDstu2.toExpungeResponse(retVal); 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerDt.class)
}) })
public Parameters expunge( public Parameters expunge(

View File

@ -61,7 +61,7 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
@Autowired(required = false) @Autowired(required = false)
private IFulltextSearchSvc mySearchDao; 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerDt.class)
}) })
public Parameters expunge( public Parameters expunge(
@ -75,7 +75,7 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
return toExpungeResponse(retVal); 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerDt.class)
}) })
public Parameters expunge( public Parameters expunge(
@ -91,7 +91,7 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
//@formatter:off //@formatter:off
// This is generated by hand: // 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),/" // 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 = "AllergyIntolerance", type = IntegerDt.class, min = 0, max = 1),
@OperationParam(name = "Appointment", 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), @OperationParam(name = "AppointmentResponse", type = IntegerDt.class, min = 0, max = 1),
@ -199,18 +199,16 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
return retVal; return retVal;
} }
//@formatter:off @Operation(name = JpaConstants.OPERATION_META, idempotent = true, returnParameters = {
@Operation(name = "$meta", idempotent = true, returnParameters = {
@OperationParam(name = "return", type = MetaDt.class) @OperationParam(name = "return", type = MetaDt.class)
}) })
//@formatter:on
public Parameters meta(RequestDetails theRequestDetails) { public Parameters meta(RequestDetails theRequestDetails) {
Parameters parameters = new Parameters(); Parameters parameters = new Parameters();
parameters.addParameter().setName("return").setValue(getDao().metaGetOperation(theRequestDetails)); parameters.addParameter().setName("return").setValue(getDao().metaGetOperation(theRequestDetails));
return parameters; return parameters;
} }
@Operation(name = "$suggest-keywords", idempotent = true) @Operation(name = JpaConstants.OPERATION_SUGGEST_KEYWORDS, idempotent = true)
public Parameters suggestKeywords( public Parameters suggestKeywords(
@OperationParam(name = "context", min = 1, max = 1) String theContext, @OperationParam(name = "context", min = 1, max = 1) String theContext,
@OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam, @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;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem.LookupCodeResult; 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.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam; import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -36,7 +37,7 @@ import java.util.List;
public class BaseJpaResourceProviderCodeSystemDstu3 extends JpaResourceProviderDstu3<CodeSystem> { public class BaseJpaResourceProviderCodeSystemDstu3 extends JpaResourceProviderDstu3<CodeSystem> {
@SuppressWarnings("unchecked") @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="name", type=StringType.class, min=1),
@OperationParam(name="version", type=StringType.class, min=0), @OperationParam(name="version", type=StringType.class, min=0),
@OperationParam(name="display", type=StringType.class, min=1), @OperationParam(name="display", type=StringType.class, min=1),

View File

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

View File

@ -1,10 +1,29 @@
package ca.uhn.fhir.jpa.provider.dstu3; 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 java.util.List;
import org.hl7.fhir.dstu3.model.*; import static org.apache.commons.lang3.StringUtils.isNotBlank;
/* /*
* #%L * #%L
@ -15,9 +34,9 @@ import org.hl7.fhir.dstu3.model.*;
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -26,53 +45,40 @@ import org.hl7.fhir.dstu3.model.*;
* #L% * #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> { public class BaseJpaResourceProviderPatientDstu3 extends JpaResourceProviderDstu3<Patient> {
/** /**
* Patient/123/$everything * Patient/123/$everything
* @param theRequestDetails
*/ */
//@formatter:off @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider patientInstanceEverything( public IBundleProvider patientInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletRequest theServletRequest,
@IdParam @IdParam
IdType theId, IdType theId,
@Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") @Description(formalDefinition = "Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
@OperationParam(name = Constants.PARAM_COUNT) @OperationParam(name = Constants.PARAM_COUNT)
UnsignedIntType theCount, UnsignedIntType theCount,
@Description(shortDefinition="Only return resources which were last updated as specified by the given range") @Description(shortDefinition = "Only return resources which were last updated as specified by the given range")
@OperationParam(name = Constants.PARAM_LASTUPDATED, min=0, max=1) @OperationParam(name = Constants.PARAM_LASTUPDATED, min = 0, max = 1)
DateRangeParam theLastUpdated, DateRangeParam theLastUpdated,
@Description(shortDefinition="Filter the resources to return only resources matching the given _content filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)") @Description(shortDefinition = "Filter the resources to return only resources matching the given _content filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)")
@OperationParam(name = Constants.PARAM_CONTENT, min=0, max=OperationParam.MAX_UNLIMITED) @OperationParam(name = Constants.PARAM_CONTENT, min = 0, max = OperationParam.MAX_UNLIMITED)
List<StringType> theContent, List<StringType> theContent,
@Description(shortDefinition="Filter the resources to return only resources matching the given _text filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)") @Description(shortDefinition = "Filter the resources to return only resources matching the given _text filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)")
@OperationParam(name = Constants.PARAM_TEXT, min=0, max=OperationParam.MAX_UNLIMITED) @OperationParam(name = Constants.PARAM_TEXT, min = 0, max = OperationParam.MAX_UNLIMITED)
List<StringType> theNarrative, List<StringType> theNarrative,
@Sort @Sort
SortSpec theSortSpec, SortSpec theSortSpec,
RequestDetails theRequestDetails RequestDetails theRequestDetails
) { ) {
//@formatter:on
startRequest(theServletRequest); startRequest(theServletRequest);
try { try {
@ -84,36 +90,33 @@ public class BaseJpaResourceProviderPatientDstu3 extends JpaResourceProviderDstu
/** /**
* /Patient/$everything * /Patient/$everything
* @param theRequestDetails
*/ */
//@formatter:off @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET) public IBundleProvider patientTypeEverything(
public IBundleProvider patientTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletRequest theServletRequest,
@Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") @Description(formalDefinition = "Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
@OperationParam(name = Constants.PARAM_COUNT) @OperationParam(name = Constants.PARAM_COUNT)
UnsignedIntType theCount, UnsignedIntType theCount,
@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
@OperationParam(name = Constants.PARAM_LASTUPDATED, min=0, max=1)
DateRangeParam theLastUpdated,
@Description(shortDefinition="Filter the resources to return only resources matching the given _content filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)") @Description(shortDefinition = "Only return resources which were last updated as specified by the given range")
@OperationParam(name = Constants.PARAM_CONTENT, min=0, max=OperationParam.MAX_UNLIMITED) @OperationParam(name = Constants.PARAM_LASTUPDATED, min = 0, max = 1)
List<StringType> theContent, DateRangeParam theLastUpdated,
@Description(shortDefinition="Filter the resources to return only resources matching the given _text filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)") @Description(shortDefinition = "Filter the resources to return only resources matching the given _content filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)")
@OperationParam(name = Constants.PARAM_TEXT, min=0, max=OperationParam.MAX_UNLIMITED) @OperationParam(name = Constants.PARAM_CONTENT, min = 0, max = OperationParam.MAX_UNLIMITED)
List<StringType> theNarrative, List<StringType> theContent,
@Sort @Description(shortDefinition = "Filter the resources to return only resources matching the given _text filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)")
SortSpec theSortSpec, @OperationParam(name = Constants.PARAM_TEXT, min = 0, max = OperationParam.MAX_UNLIMITED)
List<StringType> theNarrative,
RequestDetails theRequestDetails
) { @Sort
//@formatter:on SortSpec theSortSpec,
RequestDetails theRequestDetails
) {
startRequest(theServletRequest); startRequest(theServletRequest);
try { 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;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult; 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.IdParam;
import ca.uhn.fhir.rest.annotation.Operation; import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam; 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> { public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDstu3<ValueSet> {
@Operation(name = "$expand", idempotent = true) @Operation(name = JpaConstants.OPERATION_EXPAND, idempotent = true)
public ValueSet expand( public ValueSet expand(
HttpServletRequest theServletRequest, HttpServletRequest theServletRequest,
@IdParam(optional = true) IdType theId, @IdParam(optional = true) IdType theId,
@ -87,7 +88,7 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst
@SuppressWarnings("unchecked") @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 = "result", type = BooleanType.class, min = 1),
@OperationParam(name = "message", type = StringType.class), @OperationParam(name = "message", type = StringType.class),
@OperationParam(name = "display", 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
}) })
public Parameters expunge( 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
}) })
public Parameters expunge( public Parameters expunge(

View File

@ -37,9 +37,9 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -57,7 +57,7 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
@Autowired(required = false) @Autowired(required = false)
private IFulltextSearchSvc mySearchDao; 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
}) })
public Parameters expunge( 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
}) })
public Parameters expunge( public Parameters expunge(
@ -92,10 +92,9 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
} }
} }
//@formatter:off
// This is generated by hand: // 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),/" // 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 = "AllergyIntolerance", type = IntegerType.class, min = 0, max = 1),
@OperationParam(name = "Appointment", 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), @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) @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") @Description(shortDefinition = "Provides the number of resources currently stored on the server, broken down by resource type")
//@formatter:on
public Parameters getResourceCounts() { public Parameters getResourceCounts() {
Parameters retVal = new Parameters(); Parameters retVal = new Parameters();
@ -203,18 +201,16 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
return retVal; return retVal;
} }
//@formatter:off @Operation(name = JpaConstants.OPERATION_META, idempotent = true, returnParameters = {
@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();
parameters.addParameter().setName("return").setValue(getDao().metaGetOperation(theRequestDetails)); parameters.addParameter().setName("return").setValue(getDao().metaGetOperation(theRequestDetails));
return parameters; return parameters;
} }
@Operation(name = "$suggest-keywords", idempotent = true) @Operation(name = JpaConstants.OPERATION_SUGGEST_KEYWORDS, idempotent = true)
public Parameters suggestKeywords( public Parameters suggestKeywords(
@OperationParam(name = "context", min = 1, max = 1) String theContext, @OperationParam(name = "context", min = 1, max = 1) String theContext,
@OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam, @OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam,
@ -236,11 +232,9 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
Parameters retVal = new Parameters(); Parameters retVal = new Parameters();
for (Suggestion next : keywords) { for (Suggestion next : keywords) {
//@formatter:off
retVal.addParameter() retVal.addParameter()
.addPart(new ParametersParameterComponent().setName("keyword").setValue(new StringType(next.getTerm()))) .addPart(new ParametersParameterComponent().setName("keyword").setValue(new StringType(next.getTerm())))
.addPart(new ParametersParameterComponent().setName("score").setValue(new DecimalType(next.getScore()))); .addPart(new ParametersParameterComponent().setName("score").setValue(new DecimalType(next.getScore())));
//@formatter:on
} }
return retVal; 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;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem.LookupCodeResult; 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.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam; import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -33,7 +34,7 @@ import java.util.List;
public class BaseJpaResourceProviderCodeSystemR4 extends JpaResourceProviderR4<CodeSystem> { public class BaseJpaResourceProviderCodeSystemR4 extends JpaResourceProviderR4<CodeSystem> {
@SuppressWarnings("unchecked") @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="name", type=StringType.class, min=1),
@OperationParam(name="version", type=StringType.class, min=0), @OperationParam(name="version", type=StringType.class, min=0),
@OperationParam(name="display", type=StringType.class, min=1), @OperationParam(name="display", type=StringType.class, min=1),

View File

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

View File

@ -1,10 +1,29 @@
package ca.uhn.fhir.jpa.provider.r4; 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 java.util.List;
import org.hl7.fhir.r4.model.*; import static org.apache.commons.lang3.StringUtils.isNotBlank;
/* /*
* #%L * #%L
@ -15,9 +34,9 @@ import org.hl7.fhir.r4.model.*;
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -26,53 +45,40 @@ import org.hl7.fhir.r4.model.*;
* #L% * #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> { public class BaseJpaResourceProviderPatientR4 extends JpaResourceProviderR4<Patient> {
/** /**
* Patient/123/$everything * Patient/123/$everything
* @param theRequestDetails
*/ */
//@formatter:off @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
public IBundleProvider patientInstanceEverything( public IBundleProvider patientInstanceEverything(
javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletRequest theServletRequest,
@IdParam @IdParam
IdType theId, IdType theId,
@Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") @Description(formalDefinition = "Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
@OperationParam(name = Constants.PARAM_COUNT) @OperationParam(name = Constants.PARAM_COUNT)
UnsignedIntType theCount, UnsignedIntType theCount,
@Description(shortDefinition="Only return resources which were last updated as specified by the given range") @Description(shortDefinition = "Only return resources which were last updated as specified by the given range")
@OperationParam(name = Constants.PARAM_LASTUPDATED, min=0, max=1) @OperationParam(name = Constants.PARAM_LASTUPDATED, min = 0, max = 1)
DateRangeParam theLastUpdated, DateRangeParam theLastUpdated,
@Description(shortDefinition="Filter the resources to return only resources matching the given _content filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)") @Description(shortDefinition = "Filter the resources to return only resources matching the given _content filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)")
@OperationParam(name = Constants.PARAM_CONTENT, min=0, max=OperationParam.MAX_UNLIMITED) @OperationParam(name = Constants.PARAM_CONTENT, min = 0, max = OperationParam.MAX_UNLIMITED)
List<StringType> theContent, List<StringType> theContent,
@Description(shortDefinition="Filter the resources to return only resources matching the given _text filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)") @Description(shortDefinition = "Filter the resources to return only resources matching the given _text filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)")
@OperationParam(name = Constants.PARAM_TEXT, min=0, max=OperationParam.MAX_UNLIMITED) @OperationParam(name = Constants.PARAM_TEXT, min = 0, max = OperationParam.MAX_UNLIMITED)
List<StringType> theNarrative, List<StringType> theNarrative,
@Sort @Sort
SortSpec theSortSpec, SortSpec theSortSpec,
RequestDetails theRequestDetails RequestDetails theRequestDetails
) { ) {
//@formatter:on
startRequest(theServletRequest); startRequest(theServletRequest);
try { try {
@ -84,36 +90,33 @@ public class BaseJpaResourceProviderPatientR4 extends JpaResourceProviderR4<Pati
/** /**
* /Patient/$everything * /Patient/$everything
* @param theRequestDetails
*/ */
//@formatter:off @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
@Operation(name = "everything", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET) public IBundleProvider patientTypeEverything(
public IBundleProvider patientTypeEverything(
javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletRequest theServletRequest,
@Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") @Description(formalDefinition = "Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
@OperationParam(name = Constants.PARAM_COUNT) @OperationParam(name = Constants.PARAM_COUNT)
UnsignedIntType theCount, UnsignedIntType theCount,
@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
@OperationParam(name = Constants.PARAM_LASTUPDATED, min=0, max=1)
DateRangeParam theLastUpdated,
@Description(shortDefinition="Filter the resources to return only resources matching the given _content filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)") @Description(shortDefinition = "Only return resources which were last updated as specified by the given range")
@OperationParam(name = Constants.PARAM_CONTENT, min=0, max=OperationParam.MAX_UNLIMITED) @OperationParam(name = Constants.PARAM_LASTUPDATED, min = 0, max = 1)
List<StringType> theContent, DateRangeParam theLastUpdated,
@Description(shortDefinition="Filter the resources to return only resources matching the given _text filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)") @Description(shortDefinition = "Filter the resources to return only resources matching the given _content filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)")
@OperationParam(name = Constants.PARAM_TEXT, min=0, max=OperationParam.MAX_UNLIMITED) @OperationParam(name = Constants.PARAM_CONTENT, min = 0, max = OperationParam.MAX_UNLIMITED)
List<StringType> theNarrative, List<StringType> theContent,
@Sort @Description(shortDefinition = "Filter the resources to return only resources matching the given _text filter (note that this filter is applied only to results which link to the given patient, not to the patient itself or to supporting resources linked to by the matched resources)")
SortSpec theSortSpec, @OperationParam(name = Constants.PARAM_TEXT, min = 0, max = OperationParam.MAX_UNLIMITED)
List<StringType> theNarrative,
RequestDetails theRequestDetails
) { @Sort
//@formatter:on SortSpec theSortSpec,
RequestDetails theRequestDetails
) {
startRequest(theServletRequest); startRequest(theServletRequest);
try { 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;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult; 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.IdParam;
import ca.uhn.fhir.rest.annotation.Operation; import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam; 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> { public class BaseJpaResourceProviderValueSetR4 extends JpaResourceProviderR4<ValueSet> {
@Operation(name = "$expand", idempotent = true) @Operation(name = JpaConstants.OPERATION_EXPAND, idempotent = true)
public ValueSet expand( public ValueSet expand(
HttpServletRequest theServletRequest, HttpServletRequest theServletRequest,
@IdParam(optional = true) IdType theId, @IdParam(optional = true) IdType theId,
@ -79,7 +80,7 @@ public class BaseJpaResourceProviderValueSetR4 extends JpaResourceProviderR4<Val
@SuppressWarnings("unchecked") @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 = "result", type = BooleanType.class, min = 1),
@OperationParam(name = "message", type = StringType.class), @OperationParam(name = "message", type = StringType.class),
@OperationParam(name = "display", 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
}) })
public Parameters expunge( public Parameters expunge(
@ -89,7 +89,7 @@ public class JpaResourceProviderR4<T extends IAnyResource> extends BaseJpaResour
return super.doExpunge(theIdParam, theLimit, theExpungeDeletedResources, theExpungeOldVersions, null); 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
}) })
public Parameters expunge( public Parameters expunge(

View File

@ -34,9 +34,9 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -54,7 +54,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
@Autowired(required = false) @Autowired(required = false)
private IFulltextSearchSvc mySearchDao; 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
}) })
public Parameters expunge( public Parameters expunge(
@ -67,7 +67,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
return super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything); 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) @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, type = IntegerType.class)
}) })
public Parameters expunge( public Parameters expunge(
@ -79,10 +79,9 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
return super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything); return super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
} }
//@formatter:off
// This is generated by hand: // 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),/" // 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 = "AllergyIntolerance", type = IntegerType.class, min = 0, max = 1),
@OperationParam(name = "Appointment", 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), @OperationParam(name = "AppointmentResponse", type = IntegerType.class, min = 0, max = 1),
@ -189,7 +188,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
return retVal; return retVal;
} }
@Operation(name = "$meta", idempotent = true, returnParameters = { @Operation(name = JpaConstants.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) {
@ -198,7 +197,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
return parameters; return parameters;
} }
@Operation(name = "$suggest-keywords", idempotent = true) @Operation(name = JpaConstants.OPERATION_SUGGEST_KEYWORDS, idempotent = true)
public Parameters suggestKeywords( public Parameters suggestKeywords(
@OperationParam(name = "context", min = 1, max = 1) String theContext, @OperationParam(name = "context", min = 1, max = 1) String theContext,
@OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam, @OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam,

View File

@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.util;
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -71,7 +71,14 @@ public class JpaConstants {
/** /**
* Operation name for the $expunge operation * 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 * Parameter name for the $expunge operation
*/ */
@ -99,4 +106,39 @@ public class JpaConstants {
* be removed if they are nt explicitly included in updates * be removed if they are nt explicitly included in updates
*/ */
public static final String HEADER_META_SNAPSHOT_MODE = "X-Meta-Snapshot-Mode"; 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";
} }