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 StructureDefinitionResourceProvider extends 
022        BaseJpaResourceProviderStructureDefinitionDstu2
023        {
024
025        @Override
026        public Class<StructureDefinition> getResourceType() {
027                return StructureDefinition.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="abstract")
078                        TokenAndListParam theAbstract,
079   
080
081                        @Description(shortDefinition="")
082                        @OptionalParam(name="base")
083                        UriAndListParam theBase, 
084   
085
086                        @Description(shortDefinition="")
087                        @OptionalParam(name="base-path")
088                        TokenAndListParam theBase_path,
089   
090
091                        @Description(shortDefinition="A code for the profile")
092                        @OptionalParam(name="code")
093                        TokenAndListParam theCode,
094   
095
096                        @Description(shortDefinition="A use context assigned to the structure")
097                        @OptionalParam(name="context")
098                        TokenAndListParam theContext,
099   
100
101                        @Description(shortDefinition="")
102                        @OptionalParam(name="context-type")
103                        TokenAndListParam theContext_type,
104   
105
106                        @Description(shortDefinition="The profile publication date")
107                        @OptionalParam(name="date")
108                        DateRangeParam theDate, 
109   
110
111                        @Description(shortDefinition="Text search in the description of the profile")
112                        @OptionalParam(name="description")
113                        StringAndListParam theDescription, 
114   
115
116                        @Description(shortDefinition="")
117                        @OptionalParam(name="display")
118                        StringAndListParam theDisplay, 
119   
120
121                        @Description(shortDefinition="")
122                        @OptionalParam(name="experimental")
123                        TokenAndListParam theExperimental,
124   
125
126                        @Description(shortDefinition="")
127                        @OptionalParam(name="ext-context")
128                        StringAndListParam theExt_context, 
129   
130
131                        @Description(shortDefinition="The identifier of the profile")
132                        @OptionalParam(name="identifier")
133                        TokenAndListParam theIdentifier,
134   
135
136                        @Description(shortDefinition="")
137                        @OptionalParam(name="kind")
138                        TokenAndListParam theKind,
139   
140
141                        @Description(shortDefinition="Name of the profile")
142                        @OptionalParam(name="name")
143                        StringAndListParam theName, 
144   
145
146                        @Description(shortDefinition="A path that is constrained in the profile")
147                        @OptionalParam(name="path")
148                        TokenAndListParam thePath,
149   
150
151                        @Description(shortDefinition="Name of the publisher of the profile")
152                        @OptionalParam(name="publisher")
153                        StringAndListParam thePublisher, 
154   
155
156                        @Description(shortDefinition="The current status of the profile")
157                        @OptionalParam(name="status")
158                        TokenAndListParam theStatus,
159   
160
161                        @Description(shortDefinition="")
162                        @OptionalParam(name="type")
163                        TokenAndListParam theType,
164   
165
166                        @Description(shortDefinition="")
167                        @OptionalParam(name="url")
168                        UriAndListParam theUrl, 
169   
170
171                        @Description(shortDefinition="A vocabulary binding reference")
172                        @OptionalParam(name="valueset", targetTypes={  } )
173                        ReferenceAndListParam theValueset, 
174   
175
176                        @Description(shortDefinition="The version identifier of the profile")
177                        @OptionalParam(name="version")
178                        TokenAndListParam theVersion,
179
180                        @RawParam
181                        Map<String, List<String>> theAdditionalRawParams,
182
183                        @Description(shortDefinition="Only return resources which were last updated as specified by the given range")
184                        @OptionalParam(name="_lastUpdated")
185                        DateRangeParam theLastUpdated, 
186
187                        @IncludeParam
188                        Set<Include> theIncludes,
189
190                        @IncludeParam(reverse=true)
191                        Set<Include> theRevIncludes,
192
193                        @Sort
194                        SortSpec theSort,
195                        
196                        @ca.uhn.fhir.rest.annotation.Count
197                        Integer theCount,
198
199                        @ca.uhn.fhir.rest.annotation.Offset
200                        Integer theOffset,
201
202                        SummaryEnum theSummaryMode,
203
204                        SearchTotalModeEnum theSearchTotalMode,
205
206                        SearchContainedModeEnum theSearchContainedMode
207
208                        ) {
209                startRequest(theServletRequest);
210                try {
211                        SearchParameterMap paramMap = new SearchParameterMap();
212                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
213                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
214                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
215                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
216                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
217                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
218                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource);
219                        paramMap.add("_has", theHas);
220                        paramMap.add("_id", the_id);
221                        paramMap.add("abstract", theAbstract);
222                        paramMap.add("base", theBase);
223                        paramMap.add("base-path", theBase_path);
224                        paramMap.add("code", theCode);
225                        paramMap.add("context", theContext);
226                        paramMap.add("context-type", theContext_type);
227                        paramMap.add("date", theDate);
228                        paramMap.add("description", theDescription);
229                        paramMap.add("display", theDisplay);
230                        paramMap.add("experimental", theExperimental);
231                        paramMap.add("ext-context", theExt_context);
232                        paramMap.add("identifier", theIdentifier);
233                        paramMap.add("kind", theKind);
234                        paramMap.add("name", theName);
235                        paramMap.add("path", thePath);
236                        paramMap.add("publisher", thePublisher);
237                        paramMap.add("status", theStatus);
238                        paramMap.add("type", theType);
239                        paramMap.add("url", theUrl);
240                        paramMap.add("valueset", theValueset);
241                        paramMap.add("version", theVersion);
242                        paramMap.setRevIncludes(theRevIncludes);
243                        paramMap.setLastUpdated(theLastUpdated);
244                        paramMap.setIncludes(theIncludes);
245                        paramMap.setSort(theSort);
246                        paramMap.setCount(theCount);
247                        paramMap.setOffset(theOffset);
248                        paramMap.setSummaryMode(theSummaryMode);
249                        paramMap.setSearchTotalMode(theSearchTotalMode);
250                        paramMap.setSearchContainedMode(theSearchContainedMode);
251
252                        getDao().translateRawParameters(theAdditionalRawParams, paramMap);
253
254                        ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
255                        return retVal;
256                } finally {
257                        endRequest(theServletRequest);
258                }
259        }
260
261}