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 LocationResourceProvider extends 
21  	JpaResourceProviderDstu2<Location>
22  	{
23  
24  	@Override
25  	public Class<Location> getResourceType() {
26  		return Location.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="A (part of the) address of the location")
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="")
94  			@OptionalParam(name="identifier")
95  			TokenAndListParam theIdentifier,
96    
97  			@Description(shortDefinition="A (portion of the) name of the location")
98  			@OptionalParam(name="name")
99  			StringAndListParam theName, 
100   
101 			@Description(shortDefinition="The coordinates expressed as [lat],[long] (using the WGS84 datum, see notes) to find locations near to (servers may search using a square rather than a circle for efficiency)")
102 			@OptionalParam(name="near")
103 			TokenAndListParam theNear,
104   
105 			@Description(shortDefinition="A distance quantity to limit the near search to locations within a specific distance")
106 			@OptionalParam(name="near-distance")
107 			TokenAndListParam theNear_distance,
108   
109 			@Description(shortDefinition="Searches for locations that are managed by the provided organization")
110 			@OptionalParam(name="organization", targetTypes={  } )
111 			ReferenceAndListParam theOrganization, 
112   
113 			@Description(shortDefinition="The location of which this location is a part")
114 			@OptionalParam(name="partof", targetTypes={  } )
115 			ReferenceAndListParam thePartof, 
116   
117 			@Description(shortDefinition="Searches for locations with a specific kind of status")
118 			@OptionalParam(name="status")
119 			TokenAndListParam theStatus,
120   
121 			@Description(shortDefinition="A code for the type of location")
122 			@OptionalParam(name="type")
123 			TokenAndListParam theType,
124 
125 			@RawParam
126 			Map<String, List<String>> theAdditionalRawParams,
127 
128 			@IncludeParam(reverse=true)
129 			Set<Include> theRevIncludes,
130 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
131 			@OptionalParam(name="_lastUpdated")
132 			DateRangeParam theLastUpdated, 
133 
134 			@IncludeParam(allow= {
135 					"Location:organization" , 					"Location:partof" , 						"Location:organization" , 					"Location:partof" 					, "*"
136 			}) 
137 			Set<Include> theIncludes,
138 			
139 			@Sort 
140 			SortSpec theSort,
141 			
142 			@ca.uhn.fhir.rest.annotation.Count
143 			Integer theCount,
144 
145 			SummaryEnum theSummaryMode,
146 
147 			SearchTotalModeEnum theSearchTotalMode
148 
149 			) {
150 		startRequest(theServletRequest);
151 		try {
152 			SearchParameterMap paramMap = new SearchParameterMap();
153 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
154 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
155 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
156 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
157 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
158 			paramMap.add("_has", theHas);
159 			paramMap.add("_id", the_id);
160 			paramMap.add("_language", the_language);
161 			paramMap.add("address", theAddress);
162 			paramMap.add("address-city", theAddress_city);
163 			paramMap.add("address-country", theAddress_country);
164 			paramMap.add("address-postalcode", theAddress_postalcode);
165 			paramMap.add("address-state", theAddress_state);
166 			paramMap.add("address-use", theAddress_use);
167 			paramMap.add("identifier", theIdentifier);
168 			paramMap.add("name", theName);
169 			paramMap.add("near", theNear);
170 			paramMap.add("near-distance", theNear_distance);
171 			paramMap.add("organization", theOrganization);
172 			paramMap.add("partof", thePartof);
173 			paramMap.add("status", theStatus);
174 			paramMap.add("type", theType);
175 			paramMap.setRevIncludes(theRevIncludes);
176 			paramMap.setLastUpdated(theLastUpdated);
177 			paramMap.setIncludes(theIncludes);
178 			paramMap.setSort(theSort);
179 			paramMap.setCount(theCount);
180 			paramMap.setSummaryMode(theSummaryMode);
181 			paramMap.setSearchTotalMode(theSearchTotalMode);
182 
183 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
184 
185 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
186 			return retVal;
187 		} finally {
188 			endRequest(theServletRequest);
189 		}
190 	}
191 
192 }