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