
001 002package ca.uhn.fhir.jpa.rp.r5; 003 004import java.util.*; 005 006import org.apache.commons.lang3.StringUtils; 007 008import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; 009import ca.uhn.fhir.model.api.Include; 010import ca.uhn.fhir.model.api.annotation.*; 011import org.hl7.fhir.r5.model.*; 012import ca.uhn.fhir.rest.annotation.*; 013import ca.uhn.fhir.rest.param.*; 014import ca.uhn.fhir.rest.api.SortSpec; 015import ca.uhn.fhir.rest.api.SummaryEnum; 016import ca.uhn.fhir.rest.api.SearchTotalModeEnum; 017import ca.uhn.fhir.rest.api.SearchContainedModeEnum; 018 019public class DeviceResourceProvider extends 020 ca.uhn.fhir.jpa.provider.BaseJpaResourceProvider<Device> 021 { 022 023 @Override 024 public Class<Device> getResourceType() { 025 return Device.class; 026 } 027 028 @Search(allowUnknownParams=true) 029 public ca.uhn.fhir.rest.api.server.IBundleProvider search( 030 jakarta.servlet.http.HttpServletRequest theServletRequest, 031 jakarta.servlet.http.HttpServletResponse theServletResponse, 032 033 ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, 034 035 @Description(shortDefinition="Search the contents of the resource's data using a filter") 036 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER) 037 StringAndListParam theFtFilter, 038 039 @Description(shortDefinition="Search the contents of the resource's data using a fulltext search") 040 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT) 041 StringAndListParam theFtContent, 042 043 @Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search") 044 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT) 045 StringAndListParam theFtText, 046 047 048 @Description(shortDefinition="Search the contents of the resource's data using a list") 049 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_LIST) 050 StringAndListParam theList, 051 052 @Description(shortDefinition="The language of the resource") 053 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_LANGUAGE) 054 TokenAndListParam theResourceLanguage, 055 056 @Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)") 057 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE) 058 UriAndListParam theSearchForSource, 059 060 @Description(shortDefinition="Return resources linked to by the given target") 061 @OptionalParam(name="_has") 062 HasAndListParam theHas, 063 064 065 066 @Description(shortDefinition="The ID of the resource") 067 @OptionalParam(name="_id") 068 TokenAndListParam the_id, 069 070 071 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 072 @OptionalParam(name="_lastUpdated") 073 DateRangeParam the_lastUpdated, 074 075 076 @Description(shortDefinition="The profile of the resource") 077 @OptionalParam(name="_profile") 078 UriAndListParam the_profile, 079 080 081 @Description(shortDefinition="The security of the resource") 082 @OptionalParam(name="_security") 083 TokenAndListParam the_security, 084 085 086 @Description(shortDefinition="The tag of the resource") 087 @OptionalParam(name="_tag") 088 TokenAndListParam the_tag, 089 090 091 @Description(shortDefinition="Search on the narrative of the resource") 092 @OptionalParam(name="_text") 093 SpecialAndListParam the_text, 094 095 096 @Description(shortDefinition="The biological source for the device") 097 @OptionalParam(name="biological-source-event") 098 TokenAndListParam theBiological_source_event, 099 100 101 @Description(shortDefinition="The definition / type of the device (code)") 102 @OptionalParam(name="code") 103 TokenAndListParam theCode, 104 105 106 @Description(shortDefinition="Code and value parameter pair") 107 @OptionalParam(name="code-value-concept", compositeTypes= { TokenParam.class, StringParam.class }) 108 CompositeAndListParam<TokenParam, StringParam> theCode_value_concept, 109 110 111 @Description(shortDefinition="The definition / type of the device") 112 @OptionalParam(name="definition", targetTypes={ } ) 113 ReferenceAndListParam theDefinition, 114 115 116 @Description(shortDefinition="A server defined search that may match any of the string fields in Device.name or Device.type.") 117 @OptionalParam(name="device-name") 118 StringAndListParam theDevice_name, 119 120 121 @Description(shortDefinition="The expiration date of the device") 122 @OptionalParam(name="expiration-date") 123 DateRangeParam theExpiration_date, 124 125 126 @Description(shortDefinition="Instance id from manufacturer, owner, and others") 127 @OptionalParam(name="identifier") 128 TokenAndListParam theIdentifier, 129 130 131 @Description(shortDefinition="A location, where the resource is found") 132 @OptionalParam(name="location", targetTypes={ } ) 133 ReferenceAndListParam theLocation, 134 135 136 @Description(shortDefinition="The lot number of the device") 137 @OptionalParam(name="lot-number") 138 StringAndListParam theLot_number, 139 140 141 @Description(shortDefinition="The manufacture date of the device") 142 @OptionalParam(name="manufacture-date") 143 DateRangeParam theManufacture_date, 144 145 146 @Description(shortDefinition="The manufacturer of the device") 147 @OptionalParam(name="manufacturer") 148 StringAndListParam theManufacturer, 149 150 151 @Description(shortDefinition="The model of the device") 152 @OptionalParam(name="model") 153 StringAndListParam theModel, 154 155 156 @Description(shortDefinition="The organization responsible for the device") 157 @OptionalParam(name="organization", targetTypes={ } ) 158 ReferenceAndListParam theOrganization, 159 160 161 @Description(shortDefinition="The parent device") 162 @OptionalParam(name="parent", targetTypes={ } ) 163 ReferenceAndListParam theParent, 164 165 166 @Description(shortDefinition="The serial number of the device") 167 @OptionalParam(name="serial-number") 168 StringAndListParam theSerial_number, 169 170 171 @Description(shortDefinition="The standards, specifications, or formal guidances.") 172 @OptionalParam(name="specification") 173 TokenAndListParam theSpecification, 174 175 176 @Description(shortDefinition="A composite of both specification and version") 177 @OptionalParam(name="specification-version", compositeTypes= { TokenParam.class, StringParam.class }) 178 CompositeAndListParam<TokenParam, StringParam> theSpecification_version, 179 180 181 @Description(shortDefinition="active | inactive | entered-in-error | unknown") 182 @OptionalParam(name="status") 183 TokenAndListParam theStatus, 184 185 186 @Description(shortDefinition="The type of the device") 187 @OptionalParam(name="type") 188 TokenAndListParam theType, 189 190 191 @Description(shortDefinition="UDI Barcode (RFID or other technology) string in *HRF* format.") 192 @OptionalParam(name="udi-carrier") 193 StringAndListParam theUdi_carrier, 194 195 196 @Description(shortDefinition="The udi Device Identifier (DI)") 197 @OptionalParam(name="udi-di") 198 StringAndListParam theUdi_di, 199 200 201 @Description(shortDefinition="Network address to contact device") 202 @OptionalParam(name="url") 203 UriAndListParam theUrl, 204 205 206 @Description(shortDefinition="The specific version of the device") 207 @OptionalParam(name="version") 208 StringAndListParam theVersion, 209 210 @RawParam 211 Map<String, List<String>> theAdditionalRawParams, 212 213 214 @IncludeParam 215 Set<Include> theIncludes, 216 217 @IncludeParam(reverse=true) 218 Set<Include> theRevIncludes, 219 220 @Sort 221 SortSpec theSort, 222 223 @ca.uhn.fhir.rest.annotation.Count 224 Integer theCount, 225 226 @ca.uhn.fhir.rest.annotation.Offset 227 Integer theOffset, 228 229 SummaryEnum theSummaryMode, 230 231 SearchTotalModeEnum theSearchTotalMode, 232 233 SearchContainedModeEnum theSearchContainedMode 234 235 ) { 236 startRequest(theServletRequest); 237 try { 238 SearchParameterMap paramMap = new SearchParameterMap(); 239 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 240 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 241 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 242 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 243 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_LIST, theList); 244 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_LANGUAGE, theResourceLanguage); 245 246 paramMap.add("_has", theHas); 247 paramMap.add("_id", the_id); 248 paramMap.add("_profile", the_profile); 249 paramMap.add("_security", the_security); 250 paramMap.add("_tag", the_tag); 251 paramMap.add("_text", the_text); 252 paramMap.add("biological-source-event", theBiological_source_event); 253 paramMap.add("code", theCode); 254 paramMap.add("code-value-concept", theCode_value_concept); 255 paramMap.add("definition", theDefinition); 256 paramMap.add("device-name", theDevice_name); 257 paramMap.add("expiration-date", theExpiration_date); 258 paramMap.add("identifier", theIdentifier); 259 paramMap.add("location", theLocation); 260 paramMap.add("lot-number", theLot_number); 261 paramMap.add("manufacture-date", theManufacture_date); 262 paramMap.add("manufacturer", theManufacturer); 263 paramMap.add("model", theModel); 264 paramMap.add("organization", theOrganization); 265 paramMap.add("parent", theParent); 266 paramMap.add("serial-number", theSerial_number); 267 paramMap.add("specification", theSpecification); 268 paramMap.add("specification-version", theSpecification_version); 269 paramMap.add("status", theStatus); 270 paramMap.add("type", theType); 271 paramMap.add("udi-carrier", theUdi_carrier); 272 paramMap.add("udi-di", theUdi_di); 273 paramMap.add("url", theUrl); 274 paramMap.add("version", theVersion); 275paramMap.setRevIncludes(theRevIncludes); 276 paramMap.setLastUpdated(the_lastUpdated); 277 paramMap.setIncludes(theIncludes); 278 paramMap.setSort(theSort); 279 paramMap.setCount(theCount); 280 paramMap.setOffset(theOffset); 281 paramMap.setSummaryMode(theSummaryMode); 282 paramMap.setSearchTotalMode(theSearchTotalMode); 283 paramMap.setSearchContainedMode(theSearchContainedMode); 284 285 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 286 287 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 288 return retVal; 289 } finally { 290 endRequest(theServletRequest); 291 } 292 } 293 294}