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 CompositionResourceProvider extends 
20  	BaseJpaResourceProviderCompositionR4
21  	{
22  
23  	@Override
24  	public Class<Composition> getResourceType() {
25  		return Composition.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="Who attested the composition")
73  			@OptionalParam(name="attester", targetTypes={  } )
74  			ReferenceAndListParam theAttester, 
75    
76  			@Description(shortDefinition="Who and/or what authored the composition")
77  			@OptionalParam(name="author", targetTypes={  } )
78  			ReferenceAndListParam theAuthor, 
79    
80  			@Description(shortDefinition="Categorization of Composition")
81  			@OptionalParam(name="category")
82  			TokenAndListParam theCategory,
83    
84  			@Description(shortDefinition="As defined by affinity domain")
85  			@OptionalParam(name="confidentiality")
86  			TokenAndListParam theConfidentiality,
87    
88  			@Description(shortDefinition="Code(s) that apply to the event being documented")
89  			@OptionalParam(name="context")
90  			TokenAndListParam theContext,
91    
92  			@Description(shortDefinition="Composition editing time")
93  			@OptionalParam(name="date")
94  			DateRangeParam theDate, 
95    
96  			@Description(shortDefinition="Context of the Composition")
97  			@OptionalParam(name="encounter", targetTypes={  } )
98  			ReferenceAndListParam theEncounter, 
99    
100 			@Description(shortDefinition="A reference to data that supports this section")
101 			@OptionalParam(name="entry", targetTypes={  } )
102 			ReferenceAndListParam theEntry, 
103   
104 			@Description(shortDefinition="Version-independent identifier for the Composition")
105 			@OptionalParam(name="identifier")
106 			TokenAndListParam theIdentifier,
107   
108 			@Description(shortDefinition="Who and/or what the composition is about")
109 			@OptionalParam(name="patient", targetTypes={  } )
110 			ReferenceAndListParam thePatient, 
111   
112 			@Description(shortDefinition="The period covered by the documentation")
113 			@OptionalParam(name="period")
114 			DateRangeParam thePeriod, 
115   
116 			@Description(shortDefinition="Target of the relationship")
117 			@OptionalParam(name="related-id")
118 			TokenAndListParam theRelated_id,
119   
120 			@Description(shortDefinition="Target of the relationship")
121 			@OptionalParam(name="related-ref", targetTypes={  } )
122 			ReferenceAndListParam theRelated_ref, 
123   
124 			@Description(shortDefinition="Classification of section (recommended)")
125 			@OptionalParam(name="section")
126 			TokenAndListParam theSection,
127   
128 			@Description(shortDefinition="preliminary | final | amended | entered-in-error")
129 			@OptionalParam(name="status")
130 			TokenAndListParam theStatus,
131   
132 			@Description(shortDefinition="Who and/or what the composition is about")
133 			@OptionalParam(name="subject", targetTypes={  } )
134 			ReferenceAndListParam theSubject, 
135   
136 			@Description(shortDefinition="Human Readable name/title")
137 			@OptionalParam(name="title")
138 			StringAndListParam theTitle, 
139   
140 			@Description(shortDefinition="Kind of composition (LOINC if possible)")
141 			@OptionalParam(name="type")
142 			TokenAndListParam theType,
143 
144 			@RawParam
145 			Map<String, List<String>> theAdditionalRawParams,
146 
147 			@IncludeParam(reverse=true)
148 			Set<Include> theRevIncludes,
149 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
150 			@OptionalParam(name="_lastUpdated")
151 			DateRangeParam theLastUpdated, 
152 
153 			@IncludeParam(allow= {
154 					"Composition:attester" , 					"Composition:author" , 					"Composition:encounter" , 					"Composition:entry" , 					"Composition:patient" , 					"Composition:related-ref" , 					"Composition:subject" , 						"Composition:attester" , 					"Composition:author" , 					"Composition:encounter" , 					"Composition:entry" , 					"Composition:patient" , 					"Composition:related-ref" , 					"Composition:subject" , 						"Composition:attester" , 					"Composition:author" , 					"Composition:encounter" , 					"Composition:entry" , 					"Composition:patient" , 					"Composition:related-ref" , 					"Composition:subject" , 						"Composition:attester" , 					"Composition:author" , 					"Composition:encounter" , 					"Composition:entry" , 					"Composition:patient" , 					"Composition:related-ref" , 					"Composition:subject" , 						"Composition:attester" , 					"Composition:author" , 					"Composition:encounter" , 					"Composition:entry" , 					"Composition:patient" , 					"Composition:related-ref" , 					"Composition:subject" , 						"Composition:attester" , 					"Composition:author" , 					"Composition:encounter" , 					"Composition:entry" , 					"Composition:patient" , 					"Composition:related-ref" , 					"Composition:subject" , 						"Composition:attester" , 					"Composition:author" , 					"Composition:encounter" , 					"Composition:entry" , 					"Composition:patient" , 					"Composition:related-ref" , 					"Composition:subject" 					, "*"
155 			}) 
156 			Set<Include> theIncludes,
157 			
158 			@Sort 
159 			SortSpec theSort,
160 			
161 			@ca.uhn.fhir.rest.annotation.Count
162 			Integer theCount,
163 
164 			SummaryEnum theSummaryMode,
165 
166 			SearchTotalModeEnum theSearchTotalMode
167 
168 			) {
169 		startRequest(theServletRequest);
170 		try {
171 			SearchParameterMap paramMap = new SearchParameterMap();
172 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
173 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
174 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
175 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
176 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
177 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
178 			paramMap.add("_has", theHas);
179 			paramMap.add("_id", the_id);
180 			paramMap.add("_language", the_language);
181 			paramMap.add("attester", theAttester);
182 			paramMap.add("author", theAuthor);
183 			paramMap.add("category", theCategory);
184 			paramMap.add("confidentiality", theConfidentiality);
185 			paramMap.add("context", theContext);
186 			paramMap.add("date", theDate);
187 			paramMap.add("encounter", theEncounter);
188 			paramMap.add("entry", theEntry);
189 			paramMap.add("identifier", theIdentifier);
190 			paramMap.add("patient", thePatient);
191 			paramMap.add("period", thePeriod);
192 			paramMap.add("related-id", theRelated_id);
193 			paramMap.add("related-ref", theRelated_ref);
194 			paramMap.add("section", theSection);
195 			paramMap.add("status", theStatus);
196 			paramMap.add("subject", theSubject);
197 			paramMap.add("title", theTitle);
198 			paramMap.add("type", theType);
199 			paramMap.setRevIncludes(theRevIncludes);
200 			paramMap.setLastUpdated(theLastUpdated);
201 			paramMap.setIncludes(theIncludes);
202 			paramMap.setSort(theSort);
203 			paramMap.setCount(theCount);
204 			paramMap.setSummaryMode(theSummaryMode);
205 			paramMap.setSearchTotalMode(theSearchTotalMode);
206 
207 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
208 
209 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
210 			return retVal;
211 		} finally {
212 			endRequest(theServletRequest);
213 		}
214 	}
215 
216 }