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