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 PersonResourceProvider extends 
21  	JpaResourceProviderDstu2<Person>
22  	{
23  
24  	@Override
25  	public Class<Person> getResourceType() {
26  		return Person.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="An address in any kind of address/part")
70  			@OptionalParam(name="address")
71  			StringAndListParam theAddress, 
72    
73  			@Description(shortDefinition="A city specified in an address")
74  			@OptionalParam(name="address-city")
75  			StringAndListParam theAddress_city, 
76    
77  			@Description(shortDefinition="A country specified in an address")
78  			@OptionalParam(name="address-country")
79  			StringAndListParam theAddress_country, 
80    
81  			@Description(shortDefinition="A postal code specified in an address")
82  			@OptionalParam(name="address-postalcode")
83  			StringAndListParam theAddress_postalcode, 
84    
85  			@Description(shortDefinition="A state specified in an address")
86  			@OptionalParam(name="address-state")
87  			StringAndListParam theAddress_state, 
88    
89  			@Description(shortDefinition="A use code specified in an address")
90  			@OptionalParam(name="address-use")
91  			TokenAndListParam theAddress_use,
92    
93  			@Description(shortDefinition="The person's date of birth")
94  			@OptionalParam(name="birthdate")
95  			DateRangeParam theBirthdate, 
96    
97  			@Description(shortDefinition="A value in an email contact")
98  			@OptionalParam(name="email")
99  			TokenAndListParam theEmail,
100   
101 			@Description(shortDefinition="The gender of the person")
102 			@OptionalParam(name="gender")
103 			TokenAndListParam theGender,
104   
105 			@Description(shortDefinition="A person Identifier")
106 			@OptionalParam(name="identifier")
107 			TokenAndListParam theIdentifier,
108   
109 			@Description(shortDefinition="Any link has this Patient, Person, RelatedPerson or Practitioner reference")
110 			@OptionalParam(name="link", targetTypes={  } )
111 			ReferenceAndListParam theLink, 
112   
113 			@Description(shortDefinition="A portion of name in any name part")
114 			@OptionalParam(name="name")
115 			StringAndListParam theName, 
116   
117 			@Description(shortDefinition="The organization at which this person record is being managed")
118 			@OptionalParam(name="organization", targetTypes={  } )
119 			ReferenceAndListParam theOrganization, 
120   
121 			@Description(shortDefinition="The Person links to this Patient")
122 			@OptionalParam(name="patient", targetTypes={  } )
123 			ReferenceAndListParam thePatient, 
124   
125 			@Description(shortDefinition="A value in a phone contact")
126 			@OptionalParam(name="phone")
127 			TokenAndListParam thePhone,
128   
129 			@Description(shortDefinition="A portion of name using some kind of phonetic matching algorithm")
130 			@OptionalParam(name="phonetic")
131 			StringAndListParam thePhonetic, 
132   
133 			@Description(shortDefinition="The Person links to this Practitioner")
134 			@OptionalParam(name="practitioner", targetTypes={  } )
135 			ReferenceAndListParam thePractitioner, 
136   
137 			@Description(shortDefinition="The Person links to this RelatedPerson")
138 			@OptionalParam(name="relatedperson", targetTypes={  } )
139 			ReferenceAndListParam theRelatedperson, 
140   
141 			@Description(shortDefinition="The value in any kind of contact")
142 			@OptionalParam(name="telecom")
143 			TokenAndListParam theTelecom,
144 
145 			@RawParam
146 			Map<String, List<String>> theAdditionalRawParams,
147 
148 			@IncludeParam(reverse=true)
149 			Set<Include> theRevIncludes,
150 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
151 			@OptionalParam(name="_lastUpdated")
152 			DateRangeParam theLastUpdated, 
153 
154 			@IncludeParam(allow= {
155 					"Person:link" , 					"Person:organization" , 					"Person:patient" , 					"Person:practitioner" , 					"Person:relatedperson" , 						"Person:link" , 					"Person:organization" , 					"Person:patient" , 					"Person:practitioner" , 					"Person:relatedperson" , 						"Person:link" , 					"Person:organization" , 					"Person:patient" , 					"Person:practitioner" , 					"Person:relatedperson" , 						"Person:link" , 					"Person:organization" , 					"Person:patient" , 					"Person:practitioner" , 					"Person:relatedperson" , 						"Person:link" , 					"Person:organization" , 					"Person:patient" , 					"Person:practitioner" , 					"Person:relatedperson" 					, "*"
156 			}) 
157 			Set<Include> theIncludes,
158 			
159 			@Sort 
160 			SortSpec theSort,
161 			
162 			@ca.uhn.fhir.rest.annotation.Count
163 			Integer theCount,
164 
165 			SummaryEnum theSummaryMode,
166 
167 			SearchTotalModeEnum theSearchTotalMode
168 
169 			) {
170 		startRequest(theServletRequest);
171 		try {
172 			SearchParameterMap paramMap = new SearchParameterMap();
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("address", theAddress);
182 			paramMap.add("address-city", theAddress_city);
183 			paramMap.add("address-country", theAddress_country);
184 			paramMap.add("address-postalcode", theAddress_postalcode);
185 			paramMap.add("address-state", theAddress_state);
186 			paramMap.add("address-use", theAddress_use);
187 			paramMap.add("birthdate", theBirthdate);
188 			paramMap.add("email", theEmail);
189 			paramMap.add("gender", theGender);
190 			paramMap.add("identifier", theIdentifier);
191 			paramMap.add("link", theLink);
192 			paramMap.add("name", theName);
193 			paramMap.add("organization", theOrganization);
194 			paramMap.add("patient", thePatient);
195 			paramMap.add("phone", thePhone);
196 			paramMap.add("phonetic", thePhonetic);
197 			paramMap.add("practitioner", thePractitioner);
198 			paramMap.add("relatedperson", theRelatedperson);
199 			paramMap.add("telecom", theTelecom);
200 			paramMap.setRevIncludes(theRevIncludes);
201 			paramMap.setLastUpdated(theLastUpdated);
202 			paramMap.setIncludes(theIncludes);
203 			paramMap.setSort(theSort);
204 			paramMap.setCount(theCount);
205 			paramMap.setSummaryMode(theSummaryMode);
206 			paramMap.setSearchTotalMode(theSearchTotalMode);
207 
208 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
209 
210 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
211 			return retVal;
212 		} finally {
213 			endRequest(theServletRequest);
214 		}
215 	}
216 
217 }