View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.dstu3;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.dstu3.*;
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 org.hl7.fhir.dstu3.model.*;
13  import ca.uhn.fhir.rest.annotation.*;
14  import ca.uhn.fhir.rest.param.*;
15  import ca.uhn.fhir.rest.api.SortSpec;
16  
17  public class TaskResourceProvider extends 
18  	JpaResourceProviderDstu3<Task>
19  	{
20  
21  	@Override
22  	public Class<Task> getResourceType() {
23  		return Task.class;
24  	}
25  
26  	@Search(allowUnknownParams=true)
27  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
28  			javax.servlet.http.HttpServletRequest theServletRequest,
29  			javax.servlet.http.HttpServletResponse theServletResponse,
30  
31  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
32  			
33  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
34  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
35  			StringAndListParam theFtContent, 
36  
37  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
38  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
39  			StringAndListParam theFtText, 
40  
41  			@Description(shortDefinition="Search for resources which have the given tag")
42  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
43  			TokenAndListParam theSearchForTag, 
44  
45  			@Description(shortDefinition="Search for resources which have the given security labels")
46  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
47  			TokenAndListParam theSearchForSecurity, 
48    
49  			@Description(shortDefinition="Search for resources which have the given profile")
50  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
51  			UriAndListParam theSearchForProfile, 
52  
53  			@Description(shortDefinition="Return resources linked to by the given target")
54  			@OptionalParam(name="_has")
55  			HasAndListParam theHas, 
56  
57    
58  			@Description(shortDefinition="The ID of the resource")
59  			@OptionalParam(name="_id")
60  			TokenAndListParam the_id, 
61    
62  			@Description(shortDefinition="The language of the resource")
63  			@OptionalParam(name="_language")
64  			StringAndListParam the_language, 
65    
66  			@Description(shortDefinition="Search by creation date")
67  			@OptionalParam(name="authored-on")
68  			DateRangeParam theAuthored_on, 
69    
70  			@Description(shortDefinition="Search by requests this task is based on")
71  			@OptionalParam(name="based-on", targetTypes={  } )
72  			ReferenceAndListParam theBased_on, 
73    
74  			@Description(shortDefinition="Search by business status")
75  			@OptionalParam(name="business-status")
76  			TokenAndListParam theBusiness_status, 
77    
78  			@Description(shortDefinition="Search by task code")
79  			@OptionalParam(name="code")
80  			TokenAndListParam theCode, 
81    
82  			@Description(shortDefinition="Search by encounter or episode")
83  			@OptionalParam(name="context", targetTypes={  } )
84  			ReferenceAndListParam theContext, 
85    
86  			@Description(shortDefinition="Search by task focus")
87  			@OptionalParam(name="focus", targetTypes={  } )
88  			ReferenceAndListParam theFocus, 
89    
90  			@Description(shortDefinition="Search by group identifier")
91  			@OptionalParam(name="group-identifier")
92  			TokenAndListParam theGroup_identifier, 
93    
94  			@Description(shortDefinition="Search for a task instance by its business identifier")
95  			@OptionalParam(name="identifier")
96  			TokenAndListParam theIdentifier, 
97    
98  			@Description(shortDefinition="Search by task intent")
99  			@OptionalParam(name="intent")
100 			TokenAndListParam theIntent, 
101   
102 			@Description(shortDefinition="Search by last modification date")
103 			@OptionalParam(name="modified")
104 			DateRangeParam theModified, 
105   
106 			@Description(shortDefinition="Search by responsible organization")
107 			@OptionalParam(name="organization", targetTypes={  } )
108 			ReferenceAndListParam theOrganization, 
109   
110 			@Description(shortDefinition="Search by task owner")
111 			@OptionalParam(name="owner", targetTypes={  } )
112 			ReferenceAndListParam theOwner, 
113   
114 			@Description(shortDefinition="Search by task this task is part of")
115 			@OptionalParam(name="part-of", targetTypes={  } )
116 			ReferenceAndListParam thePart_of, 
117   
118 			@Description(shortDefinition="Search by patient")
119 			@OptionalParam(name="patient", targetTypes={  } )
120 			ReferenceAndListParam thePatient, 
121   
122 			@Description(shortDefinition="Search by recommended type of performer (e.g., Requester, Performer, Scheduler).")
123 			@OptionalParam(name="performer")
124 			TokenAndListParam thePerformer, 
125   
126 			@Description(shortDefinition="Search by period Task is/was underway")
127 			@OptionalParam(name="period")
128 			DateRangeParam thePeriod, 
129   
130 			@Description(shortDefinition="Search by task priority")
131 			@OptionalParam(name="priority")
132 			TokenAndListParam thePriority, 
133   
134 			@Description(shortDefinition="Search by task requester")
135 			@OptionalParam(name="requester", targetTypes={  } )
136 			ReferenceAndListParam theRequester, 
137   
138 			@Description(shortDefinition="Search by task status")
139 			@OptionalParam(name="status")
140 			TokenAndListParam theStatus, 
141   
142 			@Description(shortDefinition="Search by subject")
143 			@OptionalParam(name="subject", targetTypes={  } )
144 			ReferenceAndListParam theSubject, 
145 
146 			@RawParam
147 			Map<String, List<String>> theAdditionalRawParams,
148 
149 			@IncludeParam(reverse=true)
150 			Set<Include> theRevIncludes,
151 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
152 			@OptionalParam(name="_lastUpdated")
153 			DateRangeParam theLastUpdated, 
154 
155 			@IncludeParam(allow= {
156 					"Task:based-on" , 					"Task:context" , 					"Task:focus" , 					"Task:organization" , 					"Task:owner" , 					"Task:part-of" , 					"Task:patient" , 					"Task:requester" , 					"Task:subject" , 						"Task:based-on" , 					"Task:context" , 					"Task:focus" , 					"Task:organization" , 					"Task:owner" , 					"Task:part-of" , 					"Task:patient" , 					"Task:requester" , 					"Task:subject" , 						"Task:based-on" , 					"Task:context" , 					"Task:focus" , 					"Task:organization" , 					"Task:owner" , 					"Task:part-of" , 					"Task:patient" , 					"Task:requester" , 					"Task:subject" , 						"Task:based-on" , 					"Task:context" , 					"Task:focus" , 					"Task:organization" , 					"Task:owner" , 					"Task:part-of" , 					"Task:patient" , 					"Task:requester" , 					"Task:subject" , 						"Task:based-on" , 					"Task:context" , 					"Task:focus" , 					"Task:organization" , 					"Task:owner" , 					"Task:part-of" , 					"Task:patient" , 					"Task:requester" , 					"Task:subject" , 						"Task:based-on" , 					"Task:context" , 					"Task:focus" , 					"Task:organization" , 					"Task:owner" , 					"Task:part-of" , 					"Task:patient" , 					"Task:requester" , 					"Task:subject" , 						"Task:based-on" , 					"Task:context" , 					"Task:focus" , 					"Task:organization" , 					"Task:owner" , 					"Task:part-of" , 					"Task:patient" , 					"Task:requester" , 					"Task:subject" , 						"Task:based-on" , 					"Task:context" , 					"Task:focus" , 					"Task:organization" , 					"Task:owner" , 					"Task:part-of" , 					"Task:patient" , 					"Task:requester" , 					"Task:subject" , 						"Task:based-on" , 					"Task:context" , 					"Task:focus" , 					"Task:organization" , 					"Task:owner" , 					"Task:part-of" , 					"Task:patient" , 					"Task:requester" , 					"Task:subject" 					, "*"
157 			}) 
158 			Set<Include> theIncludes,
159 			
160 			@Sort 
161 			SortSpec theSort,
162 			
163 			@ca.uhn.fhir.rest.annotation.Count
164 			Integer theCount
165 	) {
166 		startRequest(theServletRequest);
167 		try {
168 			SearchParameterMap paramMap = new SearchParameterMap();
169 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
170 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
171 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
172 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
173 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
174 			paramMap.add("_has", theHas);
175 			paramMap.add("_id", the_id);
176 			paramMap.add("_language", the_language);
177 			paramMap.add("authored-on", theAuthored_on);
178 			paramMap.add("based-on", theBased_on);
179 			paramMap.add("business-status", theBusiness_status);
180 			paramMap.add("code", theCode);
181 			paramMap.add("context", theContext);
182 			paramMap.add("focus", theFocus);
183 			paramMap.add("group-identifier", theGroup_identifier);
184 			paramMap.add("identifier", theIdentifier);
185 			paramMap.add("intent", theIntent);
186 			paramMap.add("modified", theModified);
187 			paramMap.add("organization", theOrganization);
188 			paramMap.add("owner", theOwner);
189 			paramMap.add("part-of", thePart_of);
190 			paramMap.add("patient", thePatient);
191 			paramMap.add("performer", thePerformer);
192 			paramMap.add("period", thePeriod);
193 			paramMap.add("priority", thePriority);
194 			paramMap.add("requester", theRequester);
195 			paramMap.add("status", theStatus);
196 			paramMap.add("subject", theSubject);
197 			paramMap.setRevIncludes(theRevIncludes);
198 			paramMap.setLastUpdated(theLastUpdated);
199 			paramMap.setIncludes(theIncludes);
200 			paramMap.setSort(theSort);
201 			paramMap.setCount(theCount);
202 
203 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
204 
205 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
206 			return retVal;
207 		} finally {
208 			endRequest(theServletRequest);
209 		}
210 	}
211 
212 }