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 AuditEventResourceProvider extends 
022        JpaResourceProviderDstu2<AuditEvent>
023        {
024
025        @Override
026        public Class<AuditEvent> getResourceType() {
027                return AuditEvent.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="action")
078                        TokenAndListParam theAction,
079   
080
081                        @Description(shortDefinition="")
082                        @OptionalParam(name="address")
083                        TokenAndListParam theAddress,
084   
085
086                        @Description(shortDefinition="")
087                        @OptionalParam(name="altid")
088                        TokenAndListParam theAltid,
089   
090
091                        @Description(shortDefinition="")
092                        @OptionalParam(name="date")
093                        DateRangeParam theDate, 
094   
095
096                        @Description(shortDefinition="")
097                        @OptionalParam(name="desc")
098                        StringAndListParam theDesc, 
099   
100
101                        @Description(shortDefinition="")
102                        @OptionalParam(name="identity")
103                        TokenAndListParam theIdentity,
104   
105
106                        @Description(shortDefinition="")
107                        @OptionalParam(name="name")
108                        StringAndListParam theName, 
109   
110
111                        @Description(shortDefinition="")
112                        @OptionalParam(name="object-type")
113                        TokenAndListParam theObject_type,
114   
115
116                        @Description(shortDefinition="")
117                        @OptionalParam(name="participant", targetTypes={  } )
118                        ReferenceAndListParam theParticipant, 
119   
120
121                        @Description(shortDefinition="")
122                        @OptionalParam(name="patient", targetTypes={  } )
123                        ReferenceAndListParam thePatient, 
124   
125
126                        @Description(shortDefinition="")
127                        @OptionalParam(name="policy")
128                        UriAndListParam thePolicy, 
129   
130
131                        @Description(shortDefinition="")
132                        @OptionalParam(name="reference", targetTypes={  } )
133                        ReferenceAndListParam theReference, 
134   
135
136                        @Description(shortDefinition="")
137                        @OptionalParam(name="site")
138                        TokenAndListParam theSite,
139   
140
141                        @Description(shortDefinition="")
142                        @OptionalParam(name="source")
143                        TokenAndListParam theSource,
144   
145
146                        @Description(shortDefinition="")
147                        @OptionalParam(name="subtype")
148                        TokenAndListParam theSubtype,
149   
150
151                        @Description(shortDefinition="")
152                        @OptionalParam(name="type")
153                        TokenAndListParam theType,
154   
155
156                        @Description(shortDefinition="")
157                        @OptionalParam(name="user")
158                        TokenAndListParam theUser,
159
160                        @RawParam
161                        Map<String, List<String>> theAdditionalRawParams,
162
163                        @Description(shortDefinition="Only return resources which were last updated as specified by the given range")
164                        @OptionalParam(name="_lastUpdated")
165                        DateRangeParam theLastUpdated, 
166
167                        @IncludeParam
168                        Set<Include> theIncludes,
169
170                        @IncludeParam(reverse=true)
171                        Set<Include> theRevIncludes,
172
173                        @Sort
174                        SortSpec theSort,
175                        
176                        @ca.uhn.fhir.rest.annotation.Count
177                        Integer theCount,
178
179                        @ca.uhn.fhir.rest.annotation.Offset
180                        Integer theOffset,
181
182                        SummaryEnum theSummaryMode,
183
184                        SearchTotalModeEnum theSearchTotalMode,
185
186                        SearchContainedModeEnum theSearchContainedMode
187
188                        ) {
189                startRequest(theServletRequest);
190                try {
191                        SearchParameterMap paramMap = new SearchParameterMap();
192                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
193                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
194                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
195                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
196                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
197                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
198                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource);
199                        paramMap.add("_has", theHas);
200                        paramMap.add("_id", the_id);
201                        paramMap.add("action", theAction);
202                        paramMap.add("address", theAddress);
203                        paramMap.add("altid", theAltid);
204                        paramMap.add("date", theDate);
205                        paramMap.add("desc", theDesc);
206                        paramMap.add("identity", theIdentity);
207                        paramMap.add("name", theName);
208                        paramMap.add("object-type", theObject_type);
209                        paramMap.add("participant", theParticipant);
210                        paramMap.add("patient", thePatient);
211                        paramMap.add("policy", thePolicy);
212                        paramMap.add("reference", theReference);
213                        paramMap.add("site", theSite);
214                        paramMap.add("source", theSource);
215                        paramMap.add("subtype", theSubtype);
216                        paramMap.add("type", theType);
217                        paramMap.add("user", theUser);
218                        paramMap.setRevIncludes(theRevIncludes);
219                        paramMap.setLastUpdated(theLastUpdated);
220                        paramMap.setIncludes(theIncludes);
221                        paramMap.setSort(theSort);
222                        paramMap.setCount(theCount);
223                        paramMap.setOffset(theOffset);
224                        paramMap.setSummaryMode(theSummaryMode);
225                        paramMap.setSearchTotalMode(theSearchTotalMode);
226                        paramMap.setSearchContainedMode(theSearchContainedMode);
227
228                        getDao().translateRawParameters(theAdditionalRawParams, paramMap);
229
230                        ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
231                        return retVal;
232                } finally {
233                        endRequest(theServletRequest);
234                }
235        }
236
237}