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 MessageHeaderResourceProvider extends 
022        BaseJpaResourceProviderMessageHeaderDstu2
023        {
024
025        @Override
026        public Class<MessageHeader> getResourceType() {
027                return MessageHeader.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="author", targetTypes={  } )
078                        ReferenceAndListParam theAuthor, 
079   
080
081                        @Description(shortDefinition="")
082                        @OptionalParam(name="code")
083                        TokenAndListParam theCode,
084   
085
086                        @Description(shortDefinition="")
087                        @OptionalParam(name="data", targetTypes={  } )
088                        ReferenceAndListParam theData, 
089   
090
091                        @Description(shortDefinition="")
092                        @OptionalParam(name="destination")
093                        StringAndListParam theDestination, 
094   
095
096                        @Description(shortDefinition="")
097                        @OptionalParam(name="destination-uri")
098                        UriAndListParam theDestination_uri, 
099   
100
101                        @Description(shortDefinition="")
102                        @OptionalParam(name="enterer", targetTypes={  } )
103                        ReferenceAndListParam theEnterer, 
104   
105
106                        @Description(shortDefinition="")
107                        @OptionalParam(name="event")
108                        TokenAndListParam theEvent,
109   
110
111                        @Description(shortDefinition="")
112                        @OptionalParam(name="receiver", targetTypes={  } )
113                        ReferenceAndListParam theReceiver, 
114   
115
116                        @Description(shortDefinition="")
117                        @OptionalParam(name="response-id")
118                        TokenAndListParam theResponse_id,
119   
120
121                        @Description(shortDefinition="")
122                        @OptionalParam(name="responsible", targetTypes={  } )
123                        ReferenceAndListParam theResponsible, 
124   
125
126                        @Description(shortDefinition="")
127                        @OptionalParam(name="source")
128                        StringAndListParam theSource, 
129   
130
131                        @Description(shortDefinition="")
132                        @OptionalParam(name="source-uri")
133                        UriAndListParam theSource_uri, 
134   
135
136                        @Description(shortDefinition="")
137                        @OptionalParam(name="target", targetTypes={  } )
138                        ReferenceAndListParam theTarget, 
139   
140
141                        @Description(shortDefinition="")
142                        @OptionalParam(name="timestamp")
143                        DateRangeParam theTimestamp, 
144
145                        @RawParam
146                        Map<String, List<String>> theAdditionalRawParams,
147
148                        @Description(shortDefinition="Only return resources which were last updated as specified by the given range")
149                        @OptionalParam(name="_lastUpdated")
150                        DateRangeParam theLastUpdated, 
151
152                        @IncludeParam
153                        Set<Include> theIncludes,
154
155                        @IncludeParam(reverse=true)
156                        Set<Include> theRevIncludes,
157
158                        @Sort
159                        SortSpec theSort,
160                        
161                        @ca.uhn.fhir.rest.annotation.Count
162                        Integer theCount,
163
164                        @ca.uhn.fhir.rest.annotation.Offset
165                        Integer theOffset,
166
167                        SummaryEnum theSummaryMode,
168
169                        SearchTotalModeEnum theSearchTotalMode,
170
171                        SearchContainedModeEnum theSearchContainedMode
172
173                        ) {
174                startRequest(theServletRequest);
175                try {
176                        SearchParameterMap paramMap = new SearchParameterMap();
177                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
178                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
179                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
180                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
181                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
182                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
183                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource);
184                        paramMap.add("_has", theHas);
185                        paramMap.add("_id", the_id);
186                        paramMap.add("author", theAuthor);
187                        paramMap.add("code", theCode);
188                        paramMap.add("data", theData);
189                        paramMap.add("destination", theDestination);
190                        paramMap.add("destination-uri", theDestination_uri);
191                        paramMap.add("enterer", theEnterer);
192                        paramMap.add("event", theEvent);
193                        paramMap.add("receiver", theReceiver);
194                        paramMap.add("response-id", theResponse_id);
195                        paramMap.add("responsible", theResponsible);
196                        paramMap.add("source", theSource);
197                        paramMap.add("source-uri", theSource_uri);
198                        paramMap.add("target", theTarget);
199                        paramMap.add("timestamp", theTimestamp);
200                        paramMap.setRevIncludes(theRevIncludes);
201                        paramMap.setLastUpdated(theLastUpdated);
202                        paramMap.setIncludes(theIncludes);
203                        paramMap.setSort(theSort);
204                        paramMap.setCount(theCount);
205                        paramMap.setOffset(theOffset);
206                        paramMap.setSummaryMode(theSummaryMode);
207                        paramMap.setSearchTotalMode(theSearchTotalMode);
208                        paramMap.setSearchContainedMode(theSearchContainedMode);
209
210                        getDao().translateRawParameters(theAdditionalRawParams, paramMap);
211
212                        ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
213                        return retVal;
214                } finally {
215                        endRequest(theServletRequest);
216                }
217        }
218
219}