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