diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProvider.java index f982fb53e77..b40139e8c99 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProvider.java @@ -24,6 +24,8 @@ import java.util.Date; import javax.servlet.http.HttpServletRequest; +import net.sourceforge.cobertura.CoverageIgnore; + import org.springframework.beans.factory.annotation.Required; import ca.uhn.fhir.context.FhirContext; @@ -48,6 +50,7 @@ public abstract class BaseJpaResourceProvider extends BaseJ // nothing } + @CoverageIgnore public BaseJpaResourceProvider(IFhirResourceDao theDao) { myDao = theDao; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderEncounterDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderEncounterDstu2.java index 78726be2072..5763043b173 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderEncounterDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderEncounterDstu2.java @@ -22,18 +22,43 @@ package ca.uhn.fhir.jpa.provider; import java.util.Collections; -import javax.servlet.http.HttpServletRequest; - import ca.uhn.fhir.jpa.dao.SearchParameterMap; import ca.uhn.fhir.model.api.Include; +import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.dstu2.resource.Encounter; -import ca.uhn.fhir.model.primitive.IdDt; 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.param.StringParam; -import ca.uhn.fhir.rest.server.IBundleProvider; public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDstu2 { - + + @Operation(name="everything", idempotent=true) + public ca.uhn.fhir.rest.server.IBundleProvider everything( + javax.servlet.http.HttpServletRequest theServletRequest, + @IdParam ca.uhn.fhir.model.primitive.IdDt theId, + + @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") + @OperationParam(name="_count") ca.uhn.fhir.model.primitive.UnsignedIntDt theCount + ){ + + startRequest(theServletRequest); + try { + SearchParameterMap paramMap = new SearchParameterMap(); + if (theCount != null) { + paramMap.setCount(theCount.getValue()); + } + + paramMap.setRevIncludes(Collections.singleton(new Include("*"))); + paramMap.setIncludes(Collections.singleton(new Include("*"))); + paramMap.add("_id", new StringParam(theId.getIdPart())); + ca.uhn.fhir.rest.server.IBundleProvider retVal = getDao().search(paramMap); + return retVal; + } finally { + endRequest(theServletRequest); + } + + } + } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderPatientDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderPatientDstu2.java index e8b9069a567..818510a3970 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderPatientDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderPatientDstu2.java @@ -22,32 +22,41 @@ package ca.uhn.fhir.jpa.provider; import java.util.Collections; -import javax.servlet.http.HttpServletRequest; - import ca.uhn.fhir.jpa.dao.SearchParameterMap; import ca.uhn.fhir.model.api.Include; +import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.dstu2.resource.Patient; -import ca.uhn.fhir.model.primitive.IdDt; 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.param.StringParam; -import ca.uhn.fhir.rest.server.IBundleProvider; public class BaseJpaResourceProviderPatientDstu2 extends JpaResourceProviderDstu2 { - @Operation(name="$everything", idempotent=true) - public IBundleProvider everything(HttpServletRequest theServletRequest, @IdParam IdDt theId) { + @Operation(name = "everything", idempotent = true) + public ca.uhn.fhir.rest.server.IBundleProvider everything( + javax.servlet.http.HttpServletRequest theServletRequest, + @IdParam ca.uhn.fhir.model.primitive.IdDt theId, + @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") + @OperationParam(name = "_count") + ca.uhn.fhir.model.primitive.UnsignedIntDt theCount) { + startRequest(theServletRequest); try { SearchParameterMap paramMap = new SearchParameterMap(); + if (theCount != null) { + paramMap.setCount(theCount.getValue()); + } + paramMap.setRevIncludes(Collections.singleton(new Include("*"))); paramMap.setIncludes(Collections.singleton(new Include("*"))); - paramMap.add("_id", new StringParam(theId.getIdPart())); + paramMap.add("_id", new StringParam(theId.getIdPart())); ca.uhn.fhir.rest.server.IBundleProvider retVal = getDao().search(paramMap); return retVal; } finally { endRequest(theServletRequest); } + } - + } diff --git a/hapi-tinder-plugin/src/main/resources/vm/jpa_resource_provider.vm b/hapi-tinder-plugin/src/main/resources/vm/jpa_resource_provider.vm index a7d3e72d533..d59d79908b2 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/jpa_resource_provider.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/jpa_resource_provider.vm @@ -19,7 +19,13 @@ import ca.uhn.fhir.model.dstu.resource.Binary; // import ca.uhn.fhir.model.dstu2.resource.Bundle; // import ca.uhn.fhir.model.api.Bundle; -public class ${className}ResourceProvider extends JpaResourceProvider${versionCapitalized}<${className}> { +public class ${className}ResourceProvider extends +#if ( $version != 'dstu' && (${className} == 'Patient' || ${className} == 'Encounter') ) + BaseJpaResourceProvider${className}${versionCapitalized}<${className}> +#else + JpaResourceProvider${versionCapitalized}<${className}> +#end + { @Override public Class getResourceType() { @@ -121,35 +127,4 @@ public class ${className}ResourceProvider extends JpaResourceProvider${versionCa } } - - -#if ( $version != 'dstu' && (${className} == 'Patient' || ${className} == 'Encounter') ) - @Operation(name="everything", idempotent=true) - public ca.uhn.fhir.rest.server.IBundleProvider everything( - javax.servlet.http.HttpServletRequest theServletRequest, - @IdParam ca.uhn.fhir.model.primitive.IdDt theId, - - @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") - @OperationParam(name="_count") ca.uhn.fhir.model.primitive.UnsignedIntDt theCount - ){ - - startRequest(theServletRequest); - try { - SearchParameterMap paramMap = new SearchParameterMap(); - if (theCount != null) { - paramMap.setCount(theCount.getValue()); - } - - paramMap.setRevIncludes(Collections.singleton(new Include("*"))); - paramMap.setIncludes(Collections.singleton(new Include("*"))); - paramMap.add("_id", new StringParam(theId.getIdPart())); - ca.uhn.fhir.rest.server.IBundleProvider retVal = getDao().search(paramMap); - return retVal; - } finally { - endRequest(theServletRequest); - } - - } -#end - }