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 CarePlanResourceProvider extends 
21  	JpaResourceProviderDstu2<CarePlan>
22  	{
23  
24  	@Override
25  	public Class<CarePlan> getResourceType() {
26  		return CarePlan.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="activitycode")
71  			TokenAndListParam theActivitycode,
72    
73  			@Description(shortDefinition="Specified date occurs within period specified by CarePlan.activity.timingSchedule")
74  			@OptionalParam(name="activitydate")
75  			DateRangeParam theActivitydate, 
76    
77  			@Description(shortDefinition="")
78  			@OptionalParam(name="activityreference", targetTypes={  } )
79  			ReferenceAndListParam theActivityreference, 
80    
81  			@Description(shortDefinition="")
82  			@OptionalParam(name="condition", targetTypes={  } )
83  			ReferenceAndListParam theCondition, 
84    
85  			@Description(shortDefinition="")
86  			@OptionalParam(name="date")
87  			DateRangeParam theDate, 
88    
89  			@Description(shortDefinition="")
90  			@OptionalParam(name="goal", targetTypes={  } )
91  			ReferenceAndListParam theGoal, 
92    
93  			@Description(shortDefinition="")
94  			@OptionalParam(name="participant", targetTypes={  } )
95  			ReferenceAndListParam theParticipant, 
96    
97  			@Description(shortDefinition="")
98  			@OptionalParam(name="patient", targetTypes={  } )
99  			ReferenceAndListParam thePatient, 
100   
101 			@Description(shortDefinition="Matches if the practitioner is listed as a performer in any of the \"simple\" activities.  (For performers of the detailed activities, chain through the activitydetail search parameter.)")
102 			@OptionalParam(name="performer", targetTypes={  } )
103 			ReferenceAndListParam thePerformer, 
104   
105 			@Description(shortDefinition="")
106 			@OptionalParam(name="relatedcode")
107 			TokenAndListParam theRelatedcode,
108   
109 			@Description(shortDefinition="A combination of the type of relationship and the related plan")
110 			@OptionalParam(name="relatedcode-relatedplan", compositeTypes= { TokenParam.class, ReferenceParam.class })
111 			CompositeAndListParam<TokenParam, ReferenceParam> theRelatedcode_relatedplan,
112   
113 			@Description(shortDefinition="")
114 			@OptionalParam(name="relatedplan", targetTypes={  } )
115 			ReferenceAndListParam theRelatedplan, 
116   
117 			@Description(shortDefinition="")
118 			@OptionalParam(name="subject", targetTypes={  } )
119 			ReferenceAndListParam theSubject, 
120 
121 			@RawParam
122 			Map<String, List<String>> theAdditionalRawParams,
123 
124 			@IncludeParam(reverse=true)
125 			Set<Include> theRevIncludes,
126 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
127 			@OptionalParam(name="_lastUpdated")
128 			DateRangeParam theLastUpdated, 
129 
130 			@IncludeParam(allow= {
131 					"CarePlan:activityreference" , 					"CarePlan:condition" , 					"CarePlan:goal" , 					"CarePlan:participant" , 					"CarePlan:patient" , 					"CarePlan:performer" , 					"CarePlan:relatedplan" , 					"CarePlan:subject" , 						"CarePlan:activityreference" , 					"CarePlan:condition" , 					"CarePlan:goal" , 					"CarePlan:participant" , 					"CarePlan:patient" , 					"CarePlan:performer" , 					"CarePlan:relatedplan" , 					"CarePlan:subject" , 						"CarePlan:activityreference" , 					"CarePlan:condition" , 					"CarePlan:goal" , 					"CarePlan:participant" , 					"CarePlan:patient" , 					"CarePlan:performer" , 					"CarePlan:relatedplan" , 					"CarePlan:subject" , 						"CarePlan:activityreference" , 					"CarePlan:condition" , 					"CarePlan:goal" , 					"CarePlan:participant" , 					"CarePlan:patient" , 					"CarePlan:performer" , 					"CarePlan:relatedplan" , 					"CarePlan:subject" , 						"CarePlan:activityreference" , 					"CarePlan:condition" , 					"CarePlan:goal" , 					"CarePlan:participant" , 					"CarePlan:patient" , 					"CarePlan:performer" , 					"CarePlan:relatedplan" , 					"CarePlan:subject" , 						"CarePlan:activityreference" , 					"CarePlan:condition" , 					"CarePlan:goal" , 					"CarePlan:participant" , 					"CarePlan:patient" , 					"CarePlan:performer" , 					"CarePlan:relatedplan" , 					"CarePlan:subject" , 						"CarePlan:activityreference" , 					"CarePlan:condition" , 					"CarePlan:goal" , 					"CarePlan:participant" , 					"CarePlan:patient" , 					"CarePlan:performer" , 					"CarePlan:relatedplan" , 					"CarePlan:subject" , 						"CarePlan:activityreference" , 					"CarePlan:condition" , 					"CarePlan:goal" , 					"CarePlan:participant" , 					"CarePlan:patient" , 					"CarePlan:performer" , 					"CarePlan:relatedplan" , 					"CarePlan:subject" 					, "*"
132 			}) 
133 			Set<Include> theIncludes,
134 			
135 			@Sort 
136 			SortSpec theSort,
137 			
138 			@ca.uhn.fhir.rest.annotation.Count
139 			Integer theCount,
140 
141 			SummaryEnum theSummaryMode,
142 
143 			SearchTotalModeEnum theSearchTotalMode
144 
145 			) {
146 		startRequest(theServletRequest);
147 		try {
148 			SearchParameterMap paramMap = new SearchParameterMap();
149 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
150 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
151 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
152 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
153 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
154 			paramMap.add("_has", theHas);
155 			paramMap.add("_id", the_id);
156 			paramMap.add("_language", the_language);
157 			paramMap.add("activitycode", theActivitycode);
158 			paramMap.add("activitydate", theActivitydate);
159 			paramMap.add("activityreference", theActivityreference);
160 			paramMap.add("condition", theCondition);
161 			paramMap.add("date", theDate);
162 			paramMap.add("goal", theGoal);
163 			paramMap.add("participant", theParticipant);
164 			paramMap.add("patient", thePatient);
165 			paramMap.add("performer", thePerformer);
166 			paramMap.add("relatedcode", theRelatedcode);
167 			paramMap.add("relatedcode-relatedplan", theRelatedcode_relatedplan);
168 			paramMap.add("relatedplan", theRelatedplan);
169 			paramMap.add("subject", theSubject);
170 			paramMap.setRevIncludes(theRevIncludes);
171 			paramMap.setLastUpdated(theLastUpdated);
172 			paramMap.setIncludes(theIncludes);
173 			paramMap.setSort(theSort);
174 			paramMap.setCount(theCount);
175 			paramMap.setSummaryMode(theSummaryMode);
176 			paramMap.setSearchTotalMode(theSearchTotalMode);
177 
178 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
179 
180 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
181 			return retVal;
182 		} finally {
183 			endRequest(theServletRequest);
184 		}
185 	}
186 
187 }