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