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