
001package ca.uhn.fhir.jpa.provider.dstu3; 002 003import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoComposition; 004import ca.uhn.fhir.jpa.model.util.JpaConstants; 005import ca.uhn.fhir.model.api.annotation.Description; 006import ca.uhn.fhir.model.valueset.BundleTypeEnum; 007import ca.uhn.fhir.rest.annotation.IdParam; 008import ca.uhn.fhir.rest.annotation.Operation; 009import ca.uhn.fhir.rest.annotation.OperationParam; 010import ca.uhn.fhir.rest.annotation.Sort; 011import ca.uhn.fhir.rest.api.Constants; 012import ca.uhn.fhir.rest.api.SortSpec; 013import ca.uhn.fhir.rest.api.server.IBundleProvider; 014import ca.uhn.fhir.rest.api.server.RequestDetails; 015import ca.uhn.fhir.rest.param.DateRangeParam; 016import org.hl7.fhir.dstu3.model.Bundle; 017import org.hl7.fhir.dstu3.model.Composition; 018import org.hl7.fhir.dstu3.model.IdType; 019import org.hl7.fhir.dstu3.model.Resource; 020import org.hl7.fhir.dstu3.model.UnsignedIntType; 021import org.hl7.fhir.instance.model.api.IBaseBundle; 022import org.hl7.fhir.instance.model.api.IBaseResource; 023 024import java.util.List; 025 026/* 027 * #%L 028 * HAPI FHIR JPA Server 029 * %% 030 * Copyright (C) 2014 - 2022 Smile CDR, Inc. 031 * %% 032 * Licensed under the Apache License, Version 2.0 (the "License"); 033 * you may not use this file except in compliance with the License. 034 * You may obtain a copy of the License at 035 * 036 * http://www.apache.org/licenses/LICENSE-2.0 037 * 038 * Unless required by applicable law or agreed to in writing, software 039 * distributed under the License is distributed on an "AS IS" BASIS, 040 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 041 * See the License for the specific language governing permissions and 042 * limitations under the License. 043 * #L% 044 */ 045 046public class BaseJpaResourceProviderCompositionDstu3 extends JpaResourceProviderDstu3<Composition> { 047 048 /** 049 * Composition/123/$document 050 * 051 * @param theRequestDetails 052 */ 053 //@formatter:off 054 @Operation(name = JpaConstants.OPERATION_DOCUMENT, idempotent = true, bundleType=BundleTypeEnum.DOCUMENT) 055 public IBundleProvider getDocumentForComposition( 056 057 javax.servlet.http.HttpServletRequest theServletRequest, 058 059 @IdParam 060 IdType theId, 061 062 @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") 063 @OperationParam(name = Constants.PARAM_COUNT) 064 UnsignedIntType theCount, 065 066 @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the offset when fetching a page.") 067 @OperationParam(name = Constants.PARAM_OFFSET) 068 UnsignedIntType theOffset, 069 070 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 071 @OperationParam(name = Constants.PARAM_LASTUPDATED, min=0, max=1) 072 DateRangeParam theLastUpdated, 073 074 @Sort 075 SortSpec theSortSpec, 076 077 RequestDetails theRequestDetails 078 ) { 079 //@formatter:on 080 081 startRequest(theServletRequest); 082 try { 083 IBundleProvider bundleProvider = ((IFhirResourceDaoComposition<Composition>) getDao()).getDocumentForComposition(theServletRequest, theId, theCount, theOffset, theLastUpdated, theSortSpec, theRequestDetails); 084 return bundleProvider; 085 } finally { 086 endRequest(theServletRequest); 087 } 088 } 089}