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.searchparam.SearchParameterMap;
009import ca.uhn.fhir.model.api.Include;
010import ca.uhn.fhir.model.api.annotation.*;
011import ca.uhn.fhir.model.dstu2.composite.*;
012import ca.uhn.fhir.model.dstu2.resource.*; //
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 StructureDefinitionResourceProvider extends 
021        ca.uhn.fhir.jpa.provider.BaseJpaResourceProviderStructureDefinition<StructureDefinition>
022        {
023
024        @Override
025        public Class<StructureDefinition> getResourceType() {
026                return StructureDefinition.class;
027        }
028
029        @Search(allowUnknownParams=true)
030        public ca.uhn.fhir.rest.api.server.IBundleProvider search(
031                        jakarta.servlet.http.HttpServletRequest theServletRequest,
032                        jakarta.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 the contents of the resource's data using a list")
061                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_LIST)
062                        StringAndListParam theList,
063
064                        @Description(shortDefinition="The language of the resource")
065                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_LANGUAGE)
066                        TokenAndListParam theResourceLanguage,
067
068                        @Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)")
069                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE)
070                        UriAndListParam theSearchForSource,
071
072                        @Description(shortDefinition="Return resources linked to by the given target")
073                        @OptionalParam(name="_has")
074                        HasAndListParam theHas, 
075
076   
077
078                        @Description(shortDefinition="The ID of the resource")
079                        @OptionalParam(name="_id")
080                        StringAndListParam the_id, 
081   
082
083                        @Description(shortDefinition="")
084                        @OptionalParam(name="abstract")
085                        TokenAndListParam theAbstract,
086   
087
088                        @Description(shortDefinition="")
089                        @OptionalParam(name="base")
090                        UriAndListParam theBase, 
091   
092
093                        @Description(shortDefinition="")
094                        @OptionalParam(name="base-path")
095                        TokenAndListParam theBase_path,
096   
097
098                        @Description(shortDefinition="A code for the profile")
099                        @OptionalParam(name="code")
100                        TokenAndListParam theCode,
101   
102
103                        @Description(shortDefinition="A use context assigned to the structure")
104                        @OptionalParam(name="context")
105                        TokenAndListParam theContext,
106   
107
108                        @Description(shortDefinition="")
109                        @OptionalParam(name="context-type")
110                        TokenAndListParam theContext_type,
111   
112
113                        @Description(shortDefinition="The profile publication date")
114                        @OptionalParam(name="date")
115                        DateRangeParam theDate, 
116   
117
118                        @Description(shortDefinition="Text search in the description of the profile")
119                        @OptionalParam(name="description")
120                        StringAndListParam theDescription, 
121   
122
123                        @Description(shortDefinition="")
124                        @OptionalParam(name="display")
125                        StringAndListParam theDisplay, 
126   
127
128                        @Description(shortDefinition="")
129                        @OptionalParam(name="experimental")
130                        TokenAndListParam theExperimental,
131   
132
133                        @Description(shortDefinition="")
134                        @OptionalParam(name="ext-context")
135                        StringAndListParam theExt_context, 
136   
137
138                        @Description(shortDefinition="The identifier of the profile")
139                        @OptionalParam(name="identifier")
140                        TokenAndListParam theIdentifier,
141   
142
143                        @Description(shortDefinition="")
144                        @OptionalParam(name="kind")
145                        TokenAndListParam theKind,
146   
147
148                        @Description(shortDefinition="Name of the profile")
149                        @OptionalParam(name="name")
150                        StringAndListParam theName, 
151   
152
153                        @Description(shortDefinition="A path that is constrained in the profile")
154                        @OptionalParam(name="path")
155                        TokenAndListParam thePath,
156   
157
158                        @Description(shortDefinition="Name of the publisher of the profile")
159                        @OptionalParam(name="publisher")
160                        StringAndListParam thePublisher, 
161   
162
163                        @Description(shortDefinition="The current status of the profile")
164                        @OptionalParam(name="status")
165                        TokenAndListParam theStatus,
166   
167
168                        @Description(shortDefinition="")
169                        @OptionalParam(name="type")
170                        TokenAndListParam theType,
171   
172
173                        @Description(shortDefinition="")
174                        @OptionalParam(name="url")
175                        UriAndListParam theUrl, 
176   
177
178                        @Description(shortDefinition="A vocabulary binding reference")
179                        @OptionalParam(name="valueset", targetTypes={  } )
180                        ReferenceAndListParam theValueset, 
181   
182
183                        @Description(shortDefinition="The version identifier of the profile")
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 the_lastUpdated,
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(ca.uhn.fhir.rest.api.Constants.PARAM_LANGUAGE, theResourceLanguage);
228
229                        paramMap.add("_has", theHas);
230                                paramMap.add("_id", the_id);
231                                paramMap.add("abstract", theAbstract);
232                                paramMap.add("base", theBase);
233                                paramMap.add("base-path", theBase_path);
234                                paramMap.add("code", theCode);
235                                paramMap.add("context", theContext);
236                                paramMap.add("context-type", theContext_type);
237                                paramMap.add("date", theDate);
238                                paramMap.add("description", theDescription);
239                                paramMap.add("display", theDisplay);
240                                paramMap.add("experimental", theExperimental);
241                                paramMap.add("ext-context", theExt_context);
242                                paramMap.add("identifier", theIdentifier);
243                                paramMap.add("kind", theKind);
244                                paramMap.add("name", theName);
245                                paramMap.add("path", thePath);
246                                paramMap.add("publisher", thePublisher);
247                                paramMap.add("status", theStatus);
248                                paramMap.add("type", theType);
249                                paramMap.add("url", theUrl);
250                                paramMap.add("valueset", theValueset);
251                                paramMap.add("version", theVersion);
252paramMap.setRevIncludes(theRevIncludes);
253                        paramMap.setLastUpdated(the_lastUpdated);
254                        paramMap.setIncludes(theIncludes);
255                        paramMap.setSort(theSort);
256                        paramMap.setCount(theCount);
257                        paramMap.setOffset(theOffset);
258                        paramMap.setSummaryMode(theSummaryMode);
259                        paramMap.setSearchTotalMode(theSearchTotalMode);
260                        paramMap.setSearchContainedMode(theSearchContainedMode);
261
262                        getDao().translateRawParameters(theAdditionalRawParams, paramMap);
263
264                        ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
265                        return retVal;
266                } finally {
267                        endRequest(theServletRequest);
268                }
269        }
270
271}