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 OrganizationResourceProvider extends 
21  	JpaResourceProviderDstu2<Organization>
22  	{
23  
24  	@Override
25  	public Class<Organization> getResourceType() {
26  		return Organization.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="Whether the organization's record is active")
70  			@OptionalParam(name="active")
71  			TokenAndListParam theActive,
72    
73  			@Description(shortDefinition="A (part of the) address of the Organization")
74  			@OptionalParam(name="address")
75  			StringAndListParam theAddress, 
76    
77  			@Description(shortDefinition="A city specified in an address")
78  			@OptionalParam(name="address-city")
79  			StringAndListParam theAddress_city, 
80    
81  			@Description(shortDefinition="A country specified in an address")
82  			@OptionalParam(name="address-country")
83  			StringAndListParam theAddress_country, 
84    
85  			@Description(shortDefinition="A postal code specified in an address")
86  			@OptionalParam(name="address-postalcode")
87  			StringAndListParam theAddress_postalcode, 
88    
89  			@Description(shortDefinition="A state specified in an address")
90  			@OptionalParam(name="address-state")
91  			StringAndListParam theAddress_state, 
92    
93  			@Description(shortDefinition="A use code specified in an address")
94  			@OptionalParam(name="address-use")
95  			TokenAndListParam theAddress_use,
96    
97  			@Description(shortDefinition="Any identifier for the organization (not the accreditation issuer's identifier)")
98  			@OptionalParam(name="identifier")
99  			TokenAndListParam theIdentifier,
100   
101 			@Description(shortDefinition="A portion of the organization's name")
102 			@OptionalParam(name="name")
103 			StringAndListParam theName, 
104   
105 			@Description(shortDefinition="Search all organizations that are part of the given organization")
106 			@OptionalParam(name="partof", targetTypes={  } )
107 			ReferenceAndListParam thePartof, 
108   
109 			@Description(shortDefinition="A portion of the organization's name using some kind of phonetic matching algorithm")
110 			@OptionalParam(name="phonetic")
111 			StringAndListParam thePhonetic, 
112   
113 			@Description(shortDefinition="A code for the type of organization")
114 			@OptionalParam(name="type")
115 			TokenAndListParam theType,
116 
117 			@RawParam
118 			Map<String, List<String>> theAdditionalRawParams,
119 
120 			@IncludeParam(reverse=true)
121 			Set<Include> theRevIncludes,
122 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
123 			@OptionalParam(name="_lastUpdated")
124 			DateRangeParam theLastUpdated, 
125 
126 			@IncludeParam(allow= {
127 					"Organization:partof" 					, "*"
128 			}) 
129 			Set<Include> theIncludes,
130 			
131 			@Sort 
132 			SortSpec theSort,
133 			
134 			@ca.uhn.fhir.rest.annotation.Count
135 			Integer theCount,
136 
137 			SummaryEnum theSummaryMode,
138 
139 			SearchTotalModeEnum theSearchTotalMode
140 
141 			) {
142 		startRequest(theServletRequest);
143 		try {
144 			SearchParameterMap paramMap = new SearchParameterMap();
145 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
146 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
147 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
148 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
149 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
150 			paramMap.add("_has", theHas);
151 			paramMap.add("_id", the_id);
152 			paramMap.add("_language", the_language);
153 			paramMap.add("active", theActive);
154 			paramMap.add("address", theAddress);
155 			paramMap.add("address-city", theAddress_city);
156 			paramMap.add("address-country", theAddress_country);
157 			paramMap.add("address-postalcode", theAddress_postalcode);
158 			paramMap.add("address-state", theAddress_state);
159 			paramMap.add("address-use", theAddress_use);
160 			paramMap.add("identifier", theIdentifier);
161 			paramMap.add("name", theName);
162 			paramMap.add("partof", thePartof);
163 			paramMap.add("phonetic", thePhonetic);
164 			paramMap.add("type", theType);
165 			paramMap.setRevIncludes(theRevIncludes);
166 			paramMap.setLastUpdated(theLastUpdated);
167 			paramMap.setIncludes(theIncludes);
168 			paramMap.setSort(theSort);
169 			paramMap.setCount(theCount);
170 			paramMap.setSummaryMode(theSummaryMode);
171 			paramMap.setSearchTotalMode(theSearchTotalMode);
172 
173 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
174 
175 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
176 			return retVal;
177 		} finally {
178 			endRequest(theServletRequest);
179 		}
180 	}
181 
182 }