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