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.provider.r5.*; 009import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; 010import ca.uhn.fhir.model.api.Include; 011import ca.uhn.fhir.model.api.annotation.*; 012import org.hl7.fhir.r5.model.*; 013import ca.uhn.fhir.rest.annotation.*; 014import ca.uhn.fhir.rest.param.*; 015import ca.uhn.fhir.rest.api.SortSpec; 016import ca.uhn.fhir.rest.api.SummaryEnum; 017import ca.uhn.fhir.rest.api.SearchTotalModeEnum; 018import ca.uhn.fhir.rest.api.SearchContainedModeEnum; 019 020public class PlanDefinitionResourceProvider extends 021 JpaResourceProviderR5<PlanDefinition> 022 { 023 024 @Override 025 public Class<PlanDefinition> getResourceType() { 026 return PlanDefinition.class; 027 } 028 029 @Search(allowUnknownParams=true) 030 public ca.uhn.fhir.rest.api.server.IBundleProvider search( 031 javax.servlet.http.HttpServletRequest theServletRequest, 032 javax.servlet.http.HttpServletResponse theServletResponse, 033 034 ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, 035 036 @Description(shortDefinition="Search the contents of the resource's data using a filter") 037 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER) 038 StringAndListParam theFtFilter, 039 040 @Description(shortDefinition="Search the contents of the resource's data using a fulltext search") 041 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT) 042 StringAndListParam theFtContent, 043 044 @Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search") 045 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT) 046 StringAndListParam theFtText, 047 048 @Description(shortDefinition="Search for resources which have the given tag") 049 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG) 050 TokenAndListParam theSearchForTag, 051 052 @Description(shortDefinition="Search for resources which have the given security labels") 053 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY) 054 TokenAndListParam theSearchForSecurity, 055 056 @Description(shortDefinition="Search for resources which have the given profile") 057 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE) 058 UriAndListParam theSearchForProfile, 059 060 @Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)") 061 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE) 062 UriAndListParam theSearchForSource, 063 064 @Description(shortDefinition="Return resources linked to by the given target") 065 @OptionalParam(name="_has") 066 HasAndListParam theHas, 067 068 069 070 @Description(shortDefinition="The ID of the resource") 071 @OptionalParam(name="_id") 072 TokenAndListParam the_id, 073 074 075 @Description(shortDefinition="Search on the narrative of the resource") 076 @OptionalParam(name="_text") 077 SpecialAndListParam the_text, 078 079 080 @Description(shortDefinition="What resource is being referenced") 081 @OptionalParam(name="composed-of", targetTypes={ } ) 082 ReferenceAndListParam theComposed_of, 083 084 085 @Description(shortDefinition="A use context assigned to the plan definition") 086 @OptionalParam(name="context") 087 TokenAndListParam theContext, 088 089 090 @Description(shortDefinition="A quantity- or range-valued use context assigned to the plan definition") 091 @OptionalParam(name="context-quantity") 092 QuantityAndListParam theContext_quantity, 093 094 095 @Description(shortDefinition="A type of use context assigned to the plan definition") 096 @OptionalParam(name="context-type") 097 TokenAndListParam theContext_type, 098 099 100 @Description(shortDefinition="A use context type and quantity- or range-based value assigned to the plan definition") 101 @OptionalParam(name="context-type-quantity", compositeTypes= { TokenParam.class, QuantityParam.class }) 102 CompositeAndListParam<TokenParam, QuantityParam> theContext_type_quantity, 103 104 105 @Description(shortDefinition="A use context type and value assigned to the plan definition") 106 @OptionalParam(name="context-type-value", compositeTypes= { TokenParam.class, TokenParam.class }) 107 CompositeAndListParam<TokenParam, TokenParam> theContext_type_value, 108 109 110 @Description(shortDefinition="The plan definition publication date") 111 @OptionalParam(name="date") 112 DateRangeParam theDate, 113 114 115 @Description(shortDefinition="Activity or plan definitions used by plan definition") 116 @OptionalParam(name="definition", targetTypes={ } ) 117 ReferenceAndListParam theDefinition, 118 119 120 @Description(shortDefinition="What resource is being referenced") 121 @OptionalParam(name="depends-on", targetTypes={ } ) 122 ReferenceAndListParam theDepends_on, 123 124 125 @Description(shortDefinition="What resource is being referenced") 126 @OptionalParam(name="derived-from", targetTypes={ } ) 127 ReferenceAndListParam theDerived_from, 128 129 130 @Description(shortDefinition="The description of the plan definition") 131 @OptionalParam(name="description") 132 StringAndListParam theDescription, 133 134 135 @Description(shortDefinition="The time during which the plan definition is intended to be in use") 136 @OptionalParam(name="effective") 137 DateRangeParam theEffective, 138 139 140 @Description(shortDefinition="External identifier for the plan definition") 141 @OptionalParam(name="identifier") 142 TokenAndListParam theIdentifier, 143 144 145 @Description(shortDefinition="Intended jurisdiction for the plan definition") 146 @OptionalParam(name="jurisdiction") 147 TokenAndListParam theJurisdiction, 148 149 150 @Description(shortDefinition="Computationally friendly name of the plan definition") 151 @OptionalParam(name="name") 152 StringAndListParam theName, 153 154 155 @Description(shortDefinition="What resource is being referenced") 156 @OptionalParam(name="predecessor", targetTypes={ } ) 157 ReferenceAndListParam thePredecessor, 158 159 160 @Description(shortDefinition="Name of the publisher of the plan definition") 161 @OptionalParam(name="publisher") 162 StringAndListParam thePublisher, 163 164 165 @Description(shortDefinition="The current status of the plan definition") 166 @OptionalParam(name="status") 167 TokenAndListParam theStatus, 168 169 170 @Description(shortDefinition="What resource is being referenced") 171 @OptionalParam(name="successor", targetTypes={ } ) 172 ReferenceAndListParam theSuccessor, 173 174 175 @Description(shortDefinition="The human-friendly name of the plan definition") 176 @OptionalParam(name="title") 177 StringAndListParam theTitle, 178 179 180 @Description(shortDefinition="Topics associated with the module") 181 @OptionalParam(name="topic") 182 TokenAndListParam theTopic, 183 184 185 @Description(shortDefinition="The type of artifact the plan (e.g. order-set, eca-rule, protocol)") 186 @OptionalParam(name="type") 187 TokenAndListParam theType, 188 189 190 @Description(shortDefinition="The uri that identifies the plan definition") 191 @OptionalParam(name="url") 192 UriAndListParam theUrl, 193 194 195 @Description(shortDefinition="The business version of the plan definition") 196 @OptionalParam(name="version") 197 TokenAndListParam theVersion, 198 199 @RawParam 200 Map<String, List<String>> theAdditionalRawParams, 201 202 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 203 @OptionalParam(name="_lastUpdated") 204 DateRangeParam theLastUpdated, 205 206 @IncludeParam 207 Set<Include> theIncludes, 208 209 @IncludeParam(reverse=true) 210 Set<Include> theRevIncludes, 211 212 @Sort 213 SortSpec theSort, 214 215 @ca.uhn.fhir.rest.annotation.Count 216 Integer theCount, 217 218 @ca.uhn.fhir.rest.annotation.Offset 219 Integer theOffset, 220 221 SummaryEnum theSummaryMode, 222 223 SearchTotalModeEnum theSearchTotalMode, 224 225 SearchContainedModeEnum theSearchContainedMode 226 227 ) { 228 startRequest(theServletRequest); 229 try { 230 SearchParameterMap paramMap = new SearchParameterMap(); 231 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 232 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 233 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 234 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag); 235 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity); 236 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile); 237 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 238 paramMap.add("_has", theHas); 239 paramMap.add("_id", the_id); 240 paramMap.add("_text", the_text); 241 paramMap.add("composed-of", theComposed_of); 242 paramMap.add("context", theContext); 243 paramMap.add("context-quantity", theContext_quantity); 244 paramMap.add("context-type", theContext_type); 245 paramMap.add("context-type-quantity", theContext_type_quantity); 246 paramMap.add("context-type-value", theContext_type_value); 247 paramMap.add("date", theDate); 248 paramMap.add("definition", theDefinition); 249 paramMap.add("depends-on", theDepends_on); 250 paramMap.add("derived-from", theDerived_from); 251 paramMap.add("description", theDescription); 252 paramMap.add("effective", theEffective); 253 paramMap.add("identifier", theIdentifier); 254 paramMap.add("jurisdiction", theJurisdiction); 255 paramMap.add("name", theName); 256 paramMap.add("predecessor", thePredecessor); 257 paramMap.add("publisher", thePublisher); 258 paramMap.add("status", theStatus); 259 paramMap.add("successor", theSuccessor); 260 paramMap.add("title", theTitle); 261 paramMap.add("topic", theTopic); 262 paramMap.add("type", theType); 263 paramMap.add("url", theUrl); 264 paramMap.add("version", theVersion); 265 paramMap.setRevIncludes(theRevIncludes); 266 paramMap.setLastUpdated(theLastUpdated); 267 paramMap.setIncludes(theIncludes); 268 paramMap.setSort(theSort); 269 paramMap.setCount(theCount); 270 paramMap.setOffset(theOffset); 271 paramMap.setSummaryMode(theSummaryMode); 272 paramMap.setSearchTotalMode(theSearchTotalMode); 273 paramMap.setSearchContainedMode(theSearchContainedMode); 274 275 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 276 277 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 278 return retVal; 279 } finally { 280 endRequest(theServletRequest); 281 } 282 } 283 284}