View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.dstu2;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.*;
9   import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
10  import ca.uhn.fhir.model.api.Include;
11  import ca.uhn.fhir.model.api.annotation.*;
12  import ca.uhn.fhir.model.dstu2.composite.*;
13  import ca.uhn.fhir.model.dstu2.resource.*; //
14  import ca.uhn.fhir.rest.annotation.*;
15  import ca.uhn.fhir.rest.param.*;
16  import ca.uhn.fhir.rest.api.SortSpec;
17  import ca.uhn.fhir.rest.api.SummaryEnum;
18  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
19  
20  public class DocumentReferenceResourceProvider extends 
21  	JpaResourceProviderDstu2<DocumentReference>
22  	{
23  
24  	@Override
25  	public Class<DocumentReference> getResourceType() {
26  		return DocumentReference.class;
27  	}
28  
29  	@Search(allowUnknownParams=true)
30  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
31  			javax.servlet.http.HttpServletRequest theServletRequest,
32  			javax.servlet.http.HttpServletResponse theServletResponse,
33  
34  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
35  			
36  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
37  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
38  			StringAndListParam theFtContent, 
39  
40  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
41  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
42  			StringAndListParam theFtText, 
43  
44  			@Description(shortDefinition="Search for resources which have the given tag")
45  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
46  			TokenAndListParam theSearchForTag, 
47  
48  			@Description(shortDefinition="Search for resources which have the given security labels")
49  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
50  			TokenAndListParam theSearchForSecurity, 
51    
52  			@Description(shortDefinition="Search for resources which have the given profile")
53  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
54  			UriAndListParam theSearchForProfile, 
55  
56  			@Description(shortDefinition="Return resources linked to by the given target")
57  			@OptionalParam(name="_has")
58  			HasAndListParam theHas, 
59  
60    
61  			@Description(shortDefinition="The ID of the resource")
62  			@OptionalParam(name="_id")
63  			StringAndListParam the_id, 
64    
65  			@Description(shortDefinition="The language of the resource")
66  			@OptionalParam(name="_language")
67  			StringAndListParam the_language, 
68    
69  			@Description(shortDefinition="")
70  			@OptionalParam(name="authenticator", targetTypes={  } )
71  			ReferenceAndListParam theAuthenticator, 
72    
73  			@Description(shortDefinition="")
74  			@OptionalParam(name="author", targetTypes={  } )
75  			ReferenceAndListParam theAuthor, 
76    
77  			@Description(shortDefinition="")
78  			@OptionalParam(name="class")
79  			TokenAndListParam theClass,
80    
81  			@Description(shortDefinition="")
82  			@OptionalParam(name="created")
83  			DateRangeParam theCreated, 
84    
85  			@Description(shortDefinition="")
86  			@OptionalParam(name="custodian", targetTypes={  } )
87  			ReferenceAndListParam theCustodian, 
88    
89  			@Description(shortDefinition="")
90  			@OptionalParam(name="description")
91  			StringAndListParam theDescription, 
92    
93  			@Description(shortDefinition="")
94  			@OptionalParam(name="encounter", targetTypes={  } )
95  			ReferenceAndListParam theEncounter, 
96    
97  			@Description(shortDefinition="")
98  			@OptionalParam(name="event")
99  			TokenAndListParam theEvent,
100   
101 			@Description(shortDefinition="")
102 			@OptionalParam(name="facility")
103 			TokenAndListParam theFacility,
104   
105 			@Description(shortDefinition="")
106 			@OptionalParam(name="format")
107 			TokenAndListParam theFormat,
108   
109 			@Description(shortDefinition="")
110 			@OptionalParam(name="identifier")
111 			TokenAndListParam theIdentifier,
112   
113 			@Description(shortDefinition="")
114 			@OptionalParam(name="indexed")
115 			DateRangeParam theIndexed, 
116   
117 			@Description(shortDefinition="")
118 			@OptionalParam(name="language")
119 			TokenAndListParam theLanguage,
120   
121 			@Description(shortDefinition="")
122 			@OptionalParam(name="location")
123 			UriAndListParam theLocation, 
124   
125 			@Description(shortDefinition="")
126 			@OptionalParam(name="patient", targetTypes={  } )
127 			ReferenceAndListParam thePatient, 
128   
129 			@Description(shortDefinition="")
130 			@OptionalParam(name="period")
131 			DateRangeParam thePeriod, 
132   
133 			@Description(shortDefinition="")
134 			@OptionalParam(name="related-id")
135 			TokenAndListParam theRelated_id,
136   
137 			@Description(shortDefinition="")
138 			@OptionalParam(name="related-ref", targetTypes={  } )
139 			ReferenceAndListParam theRelated_ref, 
140   
141 			@Description(shortDefinition="")
142 			@OptionalParam(name="relatesto", targetTypes={  } )
143 			ReferenceAndListParam theRelatesto, 
144   
145 			@Description(shortDefinition="Combination of relation and relatesTo")
146 			@OptionalParam(name="relatesto-relation", compositeTypes= { ReferenceParam.class, TokenParam.class })
147 			CompositeAndListParam<ReferenceParam, TokenParam> theRelatesto_relation,
148   
149 			@Description(shortDefinition="")
150 			@OptionalParam(name="relation")
151 			TokenAndListParam theRelation,
152   
153 			@Description(shortDefinition="")
154 			@OptionalParam(name="securitylabel")
155 			TokenAndListParam theSecuritylabel,
156   
157 			@Description(shortDefinition="")
158 			@OptionalParam(name="setting")
159 			TokenAndListParam theSetting,
160   
161 			@Description(shortDefinition="")
162 			@OptionalParam(name="status")
163 			TokenAndListParam theStatus,
164   
165 			@Description(shortDefinition="")
166 			@OptionalParam(name="subject", targetTypes={  } )
167 			ReferenceAndListParam theSubject, 
168   
169 			@Description(shortDefinition="")
170 			@OptionalParam(name="type")
171 			TokenAndListParam theType,
172 
173 			@RawParam
174 			Map<String, List<String>> theAdditionalRawParams,
175 
176 			@IncludeParam(reverse=true)
177 			Set<Include> theRevIncludes,
178 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
179 			@OptionalParam(name="_lastUpdated")
180 			DateRangeParam theLastUpdated, 
181 
182 			@IncludeParam(allow= {
183 					"DocumentReference:authenticator" , 					"DocumentReference:author" , 					"DocumentReference:custodian" , 					"DocumentReference:encounter" , 					"DocumentReference:patient" , 					"DocumentReference:related-ref" , 					"DocumentReference:relatesto" , 					"DocumentReference:subject" , 						"DocumentReference:authenticator" , 					"DocumentReference:author" , 					"DocumentReference:custodian" , 					"DocumentReference:encounter" , 					"DocumentReference:patient" , 					"DocumentReference:related-ref" , 					"DocumentReference:relatesto" , 					"DocumentReference:subject" , 						"DocumentReference:authenticator" , 					"DocumentReference:author" , 					"DocumentReference:custodian" , 					"DocumentReference:encounter" , 					"DocumentReference:patient" , 					"DocumentReference:related-ref" , 					"DocumentReference:relatesto" , 					"DocumentReference:subject" , 						"DocumentReference:authenticator" , 					"DocumentReference:author" , 					"DocumentReference:custodian" , 					"DocumentReference:encounter" , 					"DocumentReference:patient" , 					"DocumentReference:related-ref" , 					"DocumentReference:relatesto" , 					"DocumentReference:subject" , 						"DocumentReference:authenticator" , 					"DocumentReference:author" , 					"DocumentReference:custodian" , 					"DocumentReference:encounter" , 					"DocumentReference:patient" , 					"DocumentReference:related-ref" , 					"DocumentReference:relatesto" , 					"DocumentReference:subject" , 						"DocumentReference:authenticator" , 					"DocumentReference:author" , 					"DocumentReference:custodian" , 					"DocumentReference:encounter" , 					"DocumentReference:patient" , 					"DocumentReference:related-ref" , 					"DocumentReference:relatesto" , 					"DocumentReference:subject" , 						"DocumentReference:authenticator" , 					"DocumentReference:author" , 					"DocumentReference:custodian" , 					"DocumentReference:encounter" , 					"DocumentReference:patient" , 					"DocumentReference:related-ref" , 					"DocumentReference:relatesto" , 					"DocumentReference:subject" , 						"DocumentReference:authenticator" , 					"DocumentReference:author" , 					"DocumentReference:custodian" , 					"DocumentReference:encounter" , 					"DocumentReference:patient" , 					"DocumentReference:related-ref" , 					"DocumentReference:relatesto" , 					"DocumentReference:subject" 					, "*"
184 			}) 
185 			Set<Include> theIncludes,
186 			
187 			@Sort 
188 			SortSpec theSort,
189 			
190 			@ca.uhn.fhir.rest.annotation.Count
191 			Integer theCount,
192 
193 			SummaryEnum theSummaryMode,
194 
195 			SearchTotalModeEnum theSearchTotalMode
196 
197 			) {
198 		startRequest(theServletRequest);
199 		try {
200 			SearchParameterMap paramMap = new SearchParameterMap();
201 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
202 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
203 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
204 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
205 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
206 			paramMap.add("_has", theHas);
207 			paramMap.add("_id", the_id);
208 			paramMap.add("_language", the_language);
209 			paramMap.add("authenticator", theAuthenticator);
210 			paramMap.add("author", theAuthor);
211 			paramMap.add("class", theClass);
212 			paramMap.add("created", theCreated);
213 			paramMap.add("custodian", theCustodian);
214 			paramMap.add("description", theDescription);
215 			paramMap.add("encounter", theEncounter);
216 			paramMap.add("event", theEvent);
217 			paramMap.add("facility", theFacility);
218 			paramMap.add("format", theFormat);
219 			paramMap.add("identifier", theIdentifier);
220 			paramMap.add("indexed", theIndexed);
221 			paramMap.add("language", theLanguage);
222 			paramMap.add("location", theLocation);
223 			paramMap.add("patient", thePatient);
224 			paramMap.add("period", thePeriod);
225 			paramMap.add("related-id", theRelated_id);
226 			paramMap.add("related-ref", theRelated_ref);
227 			paramMap.add("relatesto", theRelatesto);
228 			paramMap.add("relatesto-relation", theRelatesto_relation);
229 			paramMap.add("relation", theRelation);
230 			paramMap.add("securitylabel", theSecuritylabel);
231 			paramMap.add("setting", theSetting);
232 			paramMap.add("status", theStatus);
233 			paramMap.add("subject", theSubject);
234 			paramMap.add("type", theType);
235 			paramMap.setRevIncludes(theRevIncludes);
236 			paramMap.setLastUpdated(theLastUpdated);
237 			paramMap.setIncludes(theIncludes);
238 			paramMap.setSort(theSort);
239 			paramMap.setCount(theCount);
240 			paramMap.setSummaryMode(theSummaryMode);
241 			paramMap.setSearchTotalMode(theSearchTotalMode);
242 
243 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
244 
245 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
246 			return retVal;
247 		} finally {
248 			endRequest(theServletRequest);
249 		}
250 	}
251 
252 }