
001 002package ca.uhn.fhir.jpa.rp.dstu2; 003 004import java.util.*; 005 006import org.apache.commons.lang3.StringUtils; 007 008import ca.uhn.fhir.jpa.provider.*; 009import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; 010import ca.uhn.fhir.model.api.Include; 011import ca.uhn.fhir.model.api.annotation.*; 012import ca.uhn.fhir.model.dstu2.composite.*; 013import ca.uhn.fhir.model.dstu2.resource.*; // 014import ca.uhn.fhir.rest.annotation.*; 015import ca.uhn.fhir.rest.param.*; 016import ca.uhn.fhir.rest.api.SortSpec; 017import ca.uhn.fhir.rest.api.SummaryEnum; 018import ca.uhn.fhir.rest.api.SearchTotalModeEnum; 019import ca.uhn.fhir.rest.api.SearchContainedModeEnum; 020 021public class SupplyRequestResourceProvider extends 022 JpaResourceProviderDstu2<SupplyRequest> 023 { 024 025 @Override 026 public Class<SupplyRequest> getResourceType() { 027 return SupplyRequest.class; 028 } 029 030 @Search(allowUnknownParams=true) 031 public ca.uhn.fhir.rest.api.server.IBundleProvider search( 032 javax.servlet.http.HttpServletRequest theServletRequest, 033 javax.servlet.http.HttpServletResponse theServletResponse, 034 035 ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, 036 037 @Description(shortDefinition="Search the contents of the resource's data using a filter") 038 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER) 039 StringAndListParam theFtFilter, 040 041 @Description(shortDefinition="Search the contents of the resource's data using a fulltext search") 042 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT) 043 StringAndListParam theFtContent, 044 045 @Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search") 046 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT) 047 StringAndListParam theFtText, 048 049 @Description(shortDefinition="Search for resources which have the given tag") 050 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG) 051 TokenAndListParam theSearchForTag, 052 053 @Description(shortDefinition="Search for resources which have the given security labels") 054 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY) 055 TokenAndListParam theSearchForSecurity, 056 057 @Description(shortDefinition="Search for resources which have the given profile") 058 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE) 059 UriAndListParam theSearchForProfile, 060 061 @Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)") 062 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE) 063 UriAndListParam theSearchForSource, 064 065 @Description(shortDefinition="Return resources linked to by the given target") 066 @OptionalParam(name="_has") 067 HasAndListParam theHas, 068 069 070 071 @Description(shortDefinition="The ID of the resource") 072 @OptionalParam(name="_id") 073 StringAndListParam the_id, 074 075 076 @Description(shortDefinition="") 077 @OptionalParam(name="date") 078 DateRangeParam theDate, 079 080 081 @Description(shortDefinition="") 082 @OptionalParam(name="identifier") 083 TokenAndListParam theIdentifier, 084 085 086 @Description(shortDefinition="") 087 @OptionalParam(name="kind") 088 TokenAndListParam theKind, 089 090 091 @Description(shortDefinition="") 092 @OptionalParam(name="patient", targetTypes={ } ) 093 ReferenceAndListParam thePatient, 094 095 096 @Description(shortDefinition="") 097 @OptionalParam(name="source", targetTypes={ } ) 098 ReferenceAndListParam theSource, 099 100 101 @Description(shortDefinition="") 102 @OptionalParam(name="status") 103 TokenAndListParam theStatus, 104 105 106 @Description(shortDefinition="") 107 @OptionalParam(name="supplier", targetTypes={ } ) 108 ReferenceAndListParam theSupplier, 109 110 @RawParam 111 Map<String, List<String>> theAdditionalRawParams, 112 113 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 114 @OptionalParam(name="_lastUpdated") 115 DateRangeParam theLastUpdated, 116 117 @IncludeParam 118 Set<Include> theIncludes, 119 120 @IncludeParam(reverse=true) 121 Set<Include> theRevIncludes, 122 123 @Sort 124 SortSpec theSort, 125 126 @ca.uhn.fhir.rest.annotation.Count 127 Integer theCount, 128 129 @ca.uhn.fhir.rest.annotation.Offset 130 Integer theOffset, 131 132 SummaryEnum theSummaryMode, 133 134 SearchTotalModeEnum theSearchTotalMode, 135 136 SearchContainedModeEnum theSearchContainedMode 137 138 ) { 139 startRequest(theServletRequest); 140 try { 141 SearchParameterMap paramMap = new SearchParameterMap(); 142 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 143 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 144 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 145 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag); 146 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity); 147 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile); 148 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 149 paramMap.add("_has", theHas); 150 paramMap.add("_id", the_id); 151 paramMap.add("date", theDate); 152 paramMap.add("identifier", theIdentifier); 153 paramMap.add("kind", theKind); 154 paramMap.add("patient", thePatient); 155 paramMap.add("source", theSource); 156 paramMap.add("status", theStatus); 157 paramMap.add("supplier", theSupplier); 158 paramMap.setRevIncludes(theRevIncludes); 159 paramMap.setLastUpdated(theLastUpdated); 160 paramMap.setIncludes(theIncludes); 161 paramMap.setSort(theSort); 162 paramMap.setCount(theCount); 163 paramMap.setOffset(theOffset); 164 paramMap.setSummaryMode(theSummaryMode); 165 paramMap.setSearchTotalMode(theSearchTotalMode); 166 paramMap.setSearchContainedMode(theSearchContainedMode); 167 168 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 169 170 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 171 return retVal; 172 } finally { 173 endRequest(theServletRequest); 174 } 175 } 176 177}